Changeset 109 in code for trunk


Ignore:
Timestamp:
Apr 8, 2020, 12:51:14 PM (5 years ago)
Author:
sayaka
Message:

add socks5 support, close #70

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/morty.go

    r104 r109  
    2222
    2323        "github.com/valyala/fasthttp"
     24        "github.com/valyala/fasthttp/fasthttpproxy"
    2425        "golang.org/x/net/html"
    2526        "golang.org/x/net/html/charset"
     
    990991        version := flag.Bool("version", false, "Show version")
    991992        requestTimeout := flag.Uint("timeout", 2, "Request timeout")
     993        socks5 := flag.String("socks5", "", "SOCKS5 proxy")
    992994        flag.Parse()
    993995
     
    9981000
    9991001        if *ipv6 {
    1000                 CLIENT.Dial = fasthttp.DialDualStack
     1002                CLIENT.DialDualStack = true
     1003        }
     1004
     1005        if *socks5 != "" {
     1006                // this disables CLIENT.DialDualStack
     1007                CLIENT.Dial = fasthttpproxy.FasthttpSocksDialer(*socks5)
    10011008        }
    10021009
Note: See TracChangeset for help on using the changeset viewer.