add socks5 support, close #70
git-svn-id: file:///srv/svn/repo/yukari/trunk@109 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
parent
b41bcef18c
commit
a6cc8cfb67
9
morty.go
9
morty.go
@ -21,6 +21,7 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
"github.com/valyala/fasthttp/fasthttpproxy"
|
||||||
"golang.org/x/net/html"
|
"golang.org/x/net/html"
|
||||||
"golang.org/x/net/html/charset"
|
"golang.org/x/net/html/charset"
|
||||||
"golang.org/x/text/encoding"
|
"golang.org/x/text/encoding"
|
||||||
@ -989,6 +990,7 @@ func main() {
|
|||||||
ipv6 := flag.Bool("ipv6", false, "Allow IPv6 HTTP requests")
|
ipv6 := flag.Bool("ipv6", false, "Allow IPv6 HTTP requests")
|
||||||
version := flag.Bool("version", false, "Show version")
|
version := flag.Bool("version", false, "Show version")
|
||||||
requestTimeout := flag.Uint("timeout", 2, "Request timeout")
|
requestTimeout := flag.Uint("timeout", 2, "Request timeout")
|
||||||
|
socks5 := flag.String("socks5", "", "SOCKS5 proxy")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *version {
|
if *version {
|
||||||
@ -997,7 +999,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *ipv6 {
|
if *ipv6 {
|
||||||
CLIENT.Dial = fasthttp.DialDualStack
|
CLIENT.DialDualStack = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if *socks5 != "" {
|
||||||
|
// this disables CLIENT.DialDualStack
|
||||||
|
CLIENT.Dial = fasthttpproxy.FasthttpSocksDialer(*socks5)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := &Proxy{RequestTimeout: time.Duration(*requestTimeout) * time.Second}
|
p := &Proxy{RequestTimeout: time.Duration(*requestTimeout) * time.Second}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user