Last active
September 15, 2018 08:51
-
-
Save jan4984/8cc484688aca7437f8198b642155a19a to your computer and use it in GitHub Desktop.
integer goproxy http proxy server with shadowsocks-go local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//github.com/shadowsocks/shadowsocks-go/cmd/shadowsocks-local/local.go | |
import "golang.org/x/net/proxy" | |
import "github.com/elazarl/goproxy" | |
import "net/http" | |
func main(){ | |
//... | |
parseServerConfig(config) | |
//INSERT START | |
localAddr := cmdLocal + ":" + strconv.Itoa(config.LocalPort) | |
go func(){ | |
fmt.Println("sock5 dialer@", localAddr) | |
sock5Dialer, _ := proxy.SOCKS5("tcp", localAddr, nil, proxy.Direct) | |
proxy := goproxy.NewProxyHttpServer() | |
proxy.Verbose = true | |
//os.Setenv("http_proxy","http://127.0.0.1:"+config.LocalPort) | |
//os.Setenv("HTTPS_PROXY","http://127.0.0.1:"+config.LocalPort) | |
proxy.Tr.Dial = func(network, addr string) (net.Conn, error){ | |
fmt.Println("dialing to with sock5:",addr) | |
return sock5Dialer.Dial(network, addr) | |
} | |
fmt.Println("http proxy@",":1900") | |
log.Fatal(http.ListenAndServe(":1900", proxy)) | |
}() | |
//INSERT END | |
run(localAddr) | |
} | |
//then you can invoke "./local -s=SS_IP -k=SS_PWD -m=SS_METHOD -b=127.0.0.1 -l=2226 -p=443 -d" | |
//a http proxy will at http://<ip>:1900, like http://10.168.168.1:1900 | |
//the mips32 binary at http://pan.baidu.com/s/1skWVZCp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment