Skip to content

Commit

Permalink
fix: more ip fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Mar 14, 2024
1 parent e22ab53 commit ddfc0bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
10 changes: 5 additions & 5 deletions relay.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package main

import (
"log"
"fmt"
"io"
"net/http"
"strings"
)

func relay(w http.ResponseWriter, r *http.Request) {
u := r.URL
reqip := strings.Split(u.Host, ":")[0]
reqip := u.Hostname()
wsurl := ip2wsurl(reqip)
// fmt.Println(wsurl)

Expand All @@ -30,9 +30,9 @@ func relay(w http.ResponseWriter, r *http.Request) {
w.Header().Set(k, a.Header.Get(k))
}

// if a.StatusCode != 200 {
// log.Println(a.StatusCode, reqip, ip2dc(reqip), wsurl)
// }
if a.StatusCode != 200 {
log.Println(a.StatusCode, reqip, ip2dc(reqip), wsurl)
}

w.WriteHeader(a.StatusCode)

Expand Down
26 changes: 12 additions & 14 deletions tg.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/base64"
"fmt"
"log"
"net/url"
"strings"
)
Expand Down Expand Up @@ -37,12 +38,12 @@ func parseRelayProxy(a string) bool {
putmapper("149.154.175.100", 3)
putmapper("149.154.167.91", 4)
putmapper("149.154.167.92", 4)
putmapper("149.154.171.5", 5)
putmapper("2001:b28:f23d:f001:0000:0000:0000:000a", 1)
putmapper("2001:67c:4e8:f002:0000:0000:0000:000a", 2)
putmapper("2001:b28:f23d:f003:0000:0000:0000:000a", 3)
putmapper("2001:67c:4e8:f004:0000:0000:0000:000a", 4)
putmapper("2001:b28:f23f:f005:0000:0000:0000:000a", 5)
putmapper("149.154.171.", 5)
putmapper("2001:b28:f23d:f001::", 1)
putmapper("2001:67c:4e8:f002::", 2)
putmapper("2001:b28:f23d:f003::", 3)
putmapper("2001:67c:4e8:f004::", 4)
putmapper("2001:b28:f23f:f005::", 5)
putmapper("149.154.161.144", 2)
putmapper("149.154.167.", 2)
putmapper("149.154.175.1", 3)
Expand All @@ -51,17 +52,12 @@ func parseRelayProxy(a string) bool {
putmapper("149.154.165.", 4)
putmapper("149.154.166.", 4)
putmapper("91.108.56.", 5)
putmapper("2001:b28:f23d:f001:0000:0000:0000:000d", 1)
putmapper("2001:67c:4e8:f002:0000:0000:0000:000d", 2)
putmapper("2001:b28:f23d:f003:0000:0000:0000:000d", 3)
putmapper("2001:67c:4e8:f004:0000:0000:0000:000d", 4)
putmapper("2001:b28:f23f:f005:0000:0000:0000:000d", 5)
putmapper("149.154.175.40", 6)
putmapper("149.154.167.40", 7)
putmapper("149.154.175.117", 8)
putmapper("2001:b28:f23d:f001:0000:0000:0000:000e", 6)
putmapper("2001:67c:4e8:f002:0000:0000:0000:000e", 7)
putmapper("2001:b28:f23d:f003:0000:0000:0000:000e", 8)
putmapper("2001:b28:f23d:f001::e", 6)
putmapper("2001:67c:4e8:f002::e", 7)
putmapper("2001:b28:f23d:f003::e", 8)

return true
}
Expand All @@ -84,6 +80,8 @@ func ip2dc(ip string) int {
return v
}
}
log.Printf("missing: %v", ip)

return 0
}

Expand Down

0 comments on commit ddfc0bb

Please sign in to comment.