@@ -22,6 +22,7 @@ type TestConfig struct {
2222 Tag string `json:"tag"`
2323 Protocol string `json:"protocol"`
2424 Config json.RawMessage `json:"config"`
25+ ListenIP string `json:"listen_ip"`
2526 TestPort int `json:"test_port"`
2627 ClientPath string `json:"client_path"`
2728 FragmentConfig json.RawMessage `json:"fragment_config,omitempty"`
@@ -75,7 +76,7 @@ func main() {
7576
7677 fullConfig := map [string ]interface {}{
7778 "log" : map [string ]string {"loglevel" : "warning" },
78- "inbounds" : []map [string ]interface {}{{"protocol" : "socks" , "port" : c .TestPort , "listen" : "127.0.0.1" , "settings" : map [string ]interface {}{"auth" : "noauth" , "udp" : true }}},
79+ "inbounds" : []map [string ]interface {}{{"protocol" : "socks" , "port" : c .TestPort , "listen" : c . ListenIP , "settings" : map [string ]interface {}{"auth" : "noauth" , "udp" : true }}},
7980 "outbounds" : outbounds ,
8081 }
8182 configBytes , _ := json .Marshal (fullConfig )
@@ -126,7 +127,7 @@ func main() {
126127func testProxy (port int ) (int64 , string ) {
127128 targetURL := "http://www.google.com/generate_204"
128129 timeout := 8 * time .Second
129- dialer , err := proxy .SOCKS5 ("tcp" , fmt .Sprintf ("127.0.0.1 :%d" , port ), nil , proxy .Direct )
130+ dialer , err := proxy .SOCKS5 ("tcp" , fmt .Sprintf ("%s :%d" , listenIP , port ), nil , proxy .Direct )
130131 if err != nil { return - 1 , fmt .Sprintf ("failed_dialer: %v" , err ) }
131132 httpClient := & http.Client { Transport : & http.Transport {DialContext : func (ctx context.Context , network , addr string ) (net.Conn , error ) { return dialer .Dial (network , addr ) }}, Timeout : timeout }
132133 start := time .Now ()
0 commit comments