- Timestamp:
- Feb 27, 2021, 6:29:10 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/morty.go
r132 r134 38 38 ) 39 39 40 const VERSION = "v0.2. 0"40 const VERSION = "v0.2.1" 41 41 42 42 const MAX_REDIRECT_COUNT = 5 … … 1057 1057 cfg.ListenAddress = *flag.String("listen", cfg.ListenAddress, "Listen address") 1058 1058 cfg.Key = *flag.String("key", cfg.Key, "HMAC url validation key (base64 encoded) - leave blank to disable validation") 1059 cfg.IPV6 = *flag.Bool("ipv6", cfg.IPV6, "Allow IPv6 HTTP requests")1060 1059 cfg.Debug = *flag.Bool("debug", cfg.Debug, "Debug mode") 1061 1060 cfg.RequestTimeout = *flag.Uint("timeout", cfg.RequestTimeout, "Request timeout") 1062 1061 cfg.FollowRedirect = *flag.Bool("followredirect", cfg.FollowRedirect, "Follow HTTP GET redirect") 1062 proxyenv := flag.Bool("proxyenv", false, "Use a HTTP proxy as set in the environment (HTTP_PROXY, HTTPS_PROXY and NO_PROXY). Overrides -proxy, -socks5, -ipv6.") 1063 proxy := flag.String("proxy", "", "Use the specified HTTP proxy (ie: '[user:pass@]hostname:port'). Overrides -socks5, -ipv6.") 1064 socks5 := flag.String("socks5", "", "Use a SOCKS5 proxy (ie: 'hostname:port'). Overrides -ipv6.") 1065 cfg.IPV6 = *flag.Bool("ipv6", cfg.IPV6, "Use IPv6 and IPv4 to send HTTP requests.") 1063 1066 version := flag.Bool("version", false, "Show version") 1064 socks5 := flag.String("socks5", "", "SOCKS5 proxy")1065 1067 flag.Parse() 1066 1068 … … 1070 1072 } 1071 1073 1072 if *socks5 != "" { 1073 // this disables CLIENT.DialDualStack 1074 if *proxyenv && os.Getenv("HTTP_PROXY") == "" && os.Getenv("HTTPS_PROXY") == "" { 1075 log.Fatal("Error -proxyenv is used but no environment variables named 'HTTP_PROXY' and/or 'HTTPS_PROXY' could be found.") 1076 os.Exit(1) 1077 } 1078 1079 if *proxyenv && (os.Getenv("HTTP_PROXY") != "" || os.Getenv("HTTPS_PROXY") != "") { 1080 CLIENT.Dial = fasthttpproxy.FasthttpProxyHTTPDialer() 1081 log.Println("Using environment defined proxy(ies).") 1082 } else if *proxy != "" { 1083 CLIENT.Dial = fasthttpproxy.FasthttpHTTPDialer(*proxy) 1084 log.Println("Using custom HTTP proxy.") 1085 } else if *socks5 != "" { 1074 1086 CLIENT.Dial = fasthttpproxy.FasthttpSocksDialer(*socks5) 1075 }1076 if cfg.IPV6 {1087 log.Println("Using Socks5 proxy.") 1088 } else if cfg.IPV6 { 1077 1089 CLIENT.Dial = fasthttp.DialDualStack 1090 log.Println("Using dual stack (IPv4/IPv6) direct connections.") 1091 } else { 1092 CLIENT.Dial = fasthttp.Dial 1093 log.Println("Using IPv4 only direct connections.") 1078 1094 } 1079 1095
Note:
See TracChangeset
for help on using the changeset viewer.