2017-08-23 16:35:39 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os"
|
2017-08-25 20:32:51 +08:00
|
|
|
"path"
|
2017-08-23 16:35:39 +08:00
|
|
|
|
|
|
|
"github.com/nadoo/conflag"
|
2018-08-11 11:46:10 +08:00
|
|
|
|
2018-08-12 22:07:19 +08:00
|
|
|
"github.com/nadoo/glider/dns"
|
2018-08-12 22:24:49 +08:00
|
|
|
"github.com/nadoo/glider/rule"
|
2018-08-11 11:46:10 +08:00
|
|
|
"github.com/nadoo/glider/strategy"
|
2017-08-23 16:35:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var flag = conflag.New()
|
|
|
|
|
|
|
|
var conf struct {
|
2018-08-10 19:03:30 +08:00
|
|
|
Verbose bool
|
|
|
|
|
|
|
|
Listen []string
|
|
|
|
|
2018-08-11 11:46:10 +08:00
|
|
|
Forward []string
|
|
|
|
StrategyConfig strategy.Config
|
2018-08-10 19:03:30 +08:00
|
|
|
|
|
|
|
RuleFile []string
|
|
|
|
RulesDir string
|
2017-08-23 16:35:39 +08:00
|
|
|
|
2018-08-12 22:07:19 +08:00
|
|
|
DNS string
|
|
|
|
DNSConfig dns.Config
|
2017-08-23 16:35:39 +08:00
|
|
|
|
2018-08-12 22:24:49 +08:00
|
|
|
rules []*rule.Config
|
2017-08-23 16:35:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func confInit() {
|
|
|
|
flag.BoolVar(&conf.Verbose, "verbose", false, "verbose mode")
|
2018-06-03 13:54:16 +08:00
|
|
|
flag.StringSliceUniqVar(&conf.Listen, "listen", nil, "listen url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS")
|
2018-08-10 19:03:30 +08:00
|
|
|
|
2018-06-03 13:54:16 +08:00
|
|
|
flag.StringSliceUniqVar(&conf.Forward, "forward", nil, "forward url, format: SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS[,SCHEME://[USER|METHOD:PASSWORD@][HOST]:PORT?PARAMS]")
|
2018-08-10 19:03:30 +08:00
|
|
|
flag.StringVar(&conf.StrategyConfig.Strategy, "strategy", "rr", "forward strategy, default: rr")
|
|
|
|
flag.StringVar(&conf.StrategyConfig.CheckWebSite, "checkwebsite", "www.apple.com", "proxy check HTTP(NOT HTTPS) website address, format: HOST[:PORT], default port: 80")
|
2019-01-06 21:01:20 +08:00
|
|
|
flag.IntVar(&conf.StrategyConfig.CheckInterval, "checkinterval", 30, "proxy check interval(seconds)")
|
2018-08-14 19:33:18 +08:00
|
|
|
flag.IntVar(&conf.StrategyConfig.MaxFailures, "maxfailures", 3, "max failures to change forwarder status to disabled")
|
2018-08-20 22:23:00 +08:00
|
|
|
flag.StringVar(&conf.StrategyConfig.IntFace, "interface", "", "source ip or source interface")
|
2018-08-10 19:03:30 +08:00
|
|
|
|
2017-08-23 16:35:39 +08:00
|
|
|
flag.StringSliceUniqVar(&conf.RuleFile, "rulefile", nil, "rule file path")
|
2017-09-04 23:32:12 +08:00
|
|
|
flag.StringVar(&conf.RulesDir, "rules-dir", "", "rule file folder")
|
2017-08-23 16:35:39 +08:00
|
|
|
|
2018-11-28 23:28:32 +08:00
|
|
|
flag.StringVar(&conf.DNS, "dns", "", "local dns server listen address")
|
|
|
|
flag.StringSliceUniqVar(&conf.DNSConfig.Servers, "dnsserver", []string{"8.8.8.8:53"}, "remote dns server address")
|
2018-08-27 00:01:09 +08:00
|
|
|
flag.BoolVar(&conf.DNSConfig.AlwaysTCP, "dnsalwaystcp", false, "always use tcp to query upstream dns servers no matter there is a forwarder or not")
|
2018-08-12 22:07:19 +08:00
|
|
|
flag.IntVar(&conf.DNSConfig.Timeout, "dnstimeout", 3, "timeout value used in multiple dnsservers switch(seconds)")
|
|
|
|
flag.IntVar(&conf.DNSConfig.MaxTTL, "dnsmaxttl", 1800, "maximum TTL value for entries in the CACHE(seconds)")
|
|
|
|
flag.IntVar(&conf.DNSConfig.MinTTL, "dnsminttl", 0, "minimum TTL value for entries in the CACHE(seconds)")
|
|
|
|
flag.StringSliceUniqVar(&conf.DNSConfig.Records, "dnsrecord", nil, "custom dns record, format: domain/ip")
|
2017-08-23 16:35:39 +08:00
|
|
|
|
|
|
|
flag.Usage = usage
|
|
|
|
err := flag.Parse()
|
|
|
|
if err != nil {
|
2018-01-04 15:26:18 +08:00
|
|
|
flag.Usage()
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
|
|
|
os.Exit(-1)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(conf.Listen) == 0 && conf.DNS == "" {
|
|
|
|
flag.Usage()
|
|
|
|
fmt.Fprintf(os.Stderr, "ERROR: listen url must be specified.\n")
|
|
|
|
os.Exit(-1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// rulefiles
|
|
|
|
for _, ruleFile := range conf.RuleFile {
|
2018-08-30 07:36:46 +08:00
|
|
|
if !path.IsAbs(ruleFile) {
|
|
|
|
ruleFile = path.Join(flag.ConfDir(), ruleFile)
|
|
|
|
}
|
2018-09-17 19:16:17 +08:00
|
|
|
|
2018-08-12 22:24:49 +08:00
|
|
|
rule, err := rule.NewConfFromFile(ruleFile)
|
2017-08-23 16:35:39 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
conf.rules = append(conf.rules, rule)
|
|
|
|
}
|
|
|
|
|
2017-09-04 23:32:12 +08:00
|
|
|
if conf.RulesDir != "" {
|
2018-07-29 23:44:23 +08:00
|
|
|
if !path.IsAbs(conf.RulesDir) {
|
|
|
|
conf.RulesDir = path.Join(flag.ConfDir(), conf.RulesDir)
|
|
|
|
}
|
2017-08-25 20:32:51 +08:00
|
|
|
|
2018-09-17 19:16:17 +08:00
|
|
|
ruleFolderFiles, _ := rule.ListDir(conf.RulesDir, ".rule")
|
2017-09-04 23:32:12 +08:00
|
|
|
for _, ruleFile := range ruleFolderFiles {
|
2018-08-12 22:24:49 +08:00
|
|
|
rule, err := rule.NewConfFromFile(ruleFile)
|
2017-09-04 23:32:12 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
conf.rules = append(conf.rules, rule)
|
|
|
|
}
|
2017-08-23 16:35:39 +08:00
|
|
|
}
|
2017-09-04 23:32:12 +08:00
|
|
|
|
2017-08-23 16:35:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func usage() {
|
|
|
|
app := os.Args[0]
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "%s v%s usage:\n", app, VERSION)
|
|
|
|
flag.PrintDefaults()
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-06-03 13:54:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Available Schemes:\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " mixed: serve as a http/socks5 proxy on the same port. (default)\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ss: ss proxy\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " socks5: socks5 proxy\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " http: http proxy\n")
|
2018-05-20 16:59:48 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " ssr: ssr proxy\n")
|
2018-07-04 11:17:38 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " vmess: vmess proxy\n")
|
2018-07-24 00:54:38 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls: tls transport\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ws: websocket transport\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " redir: redirect proxy. (used on linux as a transparent proxy with iptables redirect rules)\n")
|
2018-09-04 20:26:40 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " redir6: redirect proxy(ipv6)\n")
|
2018-01-20 23:31:36 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tcptun: tcp tunnel\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " udptun: udp tunnel\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " uottun: udp over tcp tunnel\n")
|
2018-11-25 22:21:23 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " unix: unix domain socket\n")
|
2018-12-12 21:40:31 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " kcp: kcp protocol\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " simple-obfs: simple-obfs protocol\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-06-03 13:54:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Available schemes for different modes:\n")
|
2018-12-12 21:40:31 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " listen: mixed ss socks5 http redir redir6 tcptun udptun uottun tls unix kcp\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " forward: ss socks5 http ssr vmess tls ws unix kcp simple-bfs\n")
|
2018-05-17 10:16:00 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-06-03 13:54:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "SS scheme:\n")
|
2018-05-17 10:16:00 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " ss://method:pass@host:port\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Available methods for ss:\n")
|
2018-09-02 22:16:24 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " AEAD Ciphers:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " Stream Ciphers:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " Alias:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-06-03 13:54:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "SSR scheme:\n")
|
2018-05-17 10:16:00 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " ssr://method:pass@host:port?protocol=xxx&protocol_param=yyy&obfs=zzz&obfs_param=xyz\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-07-04 11:17:38 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "VMess scheme:\n")
|
2018-07-06 11:13:25 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " vmess://[security:]uuid@host:port?alterID=num\n")
|
2018-07-04 11:17:38 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-07-12 11:22:21 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Available securities for vmess:\n")
|
2018-07-11 08:34:15 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " none, aes-128-gcm, chacha20-poly1305\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-11-28 23:28:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "TLS client scheme:\n")
|
2018-07-11 08:34:15 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-11-28 23:28:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Proxy over tls client:\n")
|
2018-07-24 00:45:41 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],scheme://\n")
|
2018-07-11 08:34:15 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],http://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],socks5://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num\n")
|
2018-07-05 20:44:19 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-11-28 23:28:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "TLS server scheme:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port?cert=PATH&key=PATH\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Proxy over tls server:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port?cert=PATH&key=PATH,scheme://\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port?cert=PATH&key=PATH,http://\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port?cert=PATH&key=PATH,socks5://\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port?cert=PATH&key=PATH,ss://method:pass@\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-07-22 20:02:50 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Websocket scheme:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ws://host:port[/path]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Websocket with a specified proxy protocol:\n")
|
2018-07-24 00:45:41 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " ws://host:port[/path],scheme://\n")
|
2018-07-22 20:02:50 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " ws://host:port[/path],http://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ws://host:port[/path],socks5://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ws://host:port[/path],vmess://[security:]uuid@?alterID=num\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "TLS and Websocket with a specified proxy protocol:\n")
|
2018-07-24 00:45:41 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],ws://[@/path],scheme://\n")
|
2018-07-22 20:02:50 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],ws://[@/path],http://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],ws://[@/path],socks5://[user:pass@]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],ws://[@/path],vmess://[security:]uuid@?alterID=num\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-11-25 22:21:23 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Unix domain socket scheme:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " unix://path\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-12-12 21:40:31 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "KCP scheme:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Available crypt types for KCP:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " none, sm4, tea, xor, aes, aes-128, aes-192, blowfish, twofish, cast5, 3des, xtea, salsa20\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Simple-Obfs scheme:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Available types for simple-obfs:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " http, tls\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-08-01 00:36:11 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "DNS forwarding server:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " dns=:53\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " dnsserver=8.8.8.8:53\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " dnsserver=1.1.1.1:53\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " dnsrecord=www.example.com/1.2.3.4\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " dnsrecord=www.example.com/2606:2800:220:1:248:1893:25c8:1946\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Available forward strategies:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " rr: Round Robin mode\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " ha: High Availability mode\n")
|
2018-08-14 19:52:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " lha: Latency based High Availability mode\n")
|
2018-08-27 19:38:42 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " dh: Destination Hashing mode\n")
|
2018-08-14 19:52:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
2018-08-15 00:54:17 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "Forwarder option scheme: FORWARD_URL#OPTIONS\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " priority: set the priority of that forwarder, default:0\n")
|
2018-08-20 00:17:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " interface: set local interface or ip address used to connect remote server\n")
|
2018-08-16 00:01:59 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " Examples:\n")
|
2018-08-14 19:52:32 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " socks5://1.1.1.1:1080#priority=100\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " vmess://[security:]uuid@host:port?alterID=num#priority=200\n")
|
2018-08-20 00:17:16 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=192.168.1.99\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " vmess://[security:]uuid@host:port?alterID=num#priority=200&interface=eth0\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Config file format(see `"+app+".conf.example` as an example):\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " # COMMENT LINE\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " KEY=VALUE\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " KEY=VALUE\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " # KEY equals to command line flag name: listen forward strategy...\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Examples:\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -config glider.conf\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -run glider with specified config file.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -config glider.conf -rulefile office.rule -rulefile home.rule\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -run glider with specified global config file and rule config files.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen :8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :8443, serve as http/socks5 proxy on the same port.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen ss://AEAD_CHACHA20_POLY1305:pass@:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on 0.0.0.0:8443 as a ss server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -verbose\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1080 as a socks5 proxy server, in verbose mode.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-11-27 23:25:20 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen tls://:443?cert=crtFilePath&key=keyFilePath,http:// -verbose\n")
|
2018-12-14 00:02:25 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :443 as a https(http over tls) proxy server.\n")
|
2018-11-25 22:21:23 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen http://:8080 -forward socks5://127.0.0.1:1080\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :8080 as a http proxy server, forward all requests via socks5 server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1081 as a transparent redirect server, forward all requests via remote ss server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-05-22 12:19:57 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -forward \"ssr://method:pass@1.1.1.1:8444?protocol=a&protocol_param=b&obfs=c&obfs_param=d\"\n")
|
2018-05-17 10:16:00 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1081 as a transparent redirect server, forward all requests via remote ssr server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-07-12 11:22:21 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -forward \"tls://1.1.1.1:443,vmess://security:uuid@?alterID=10\"\n")
|
2018-07-24 00:45:41 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1081 as a transparent redirect server, forward all requests via remote tls+vmess server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -forward \"ws://1.1.1.1:80,vmess://security:uuid@?alterID=10\"\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1081 as a transparent redirect server, forward all requests via remote ws+vmess server.\n")
|
2018-07-04 11:17:38 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen tcptun://:80=2.2.2.2:80 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :80 and forward all requests to 2.2.2.2:80 via remote ss server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-01-20 23:27:22 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen udptun://:53=8.8.8.8:53 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :53 and forward all udp requests to 8.8.8.8:53 via remote ss server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen uottun://:53=8.8.8.8:53 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :53 and forward all udp requests via udp over tcp tunnel.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -listen http://:8080 -forward ss://method:pass@1.1.1.1:8443\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1080 as socks5 server, :8080 as http proxy server, forward all requests via remote ss server.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-08-01 00:36:11 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -dns=:53 -dnsserver=8.8.8.8:53 -forward ss://method:pass@server1:port1,ss://method:pass@server2:port2\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1081 as transparent redirect server, :53 as dns server, use forward chain: server1 -> server2.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -forward ss://method:pass@server1:port1 -forward ss://method:pass@server2:port2 -strategy rr\n")
|
2018-02-25 12:31:48 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :1080 as socks5 server, forward requests via server1 and server2 in round robin mode.\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2018-08-01 00:36:11 +08:00
|
|
|
fmt.Fprintf(os.Stderr, " "+app+" -verbose -dns=:53 -dnsserver=8.8.8.8:53 -dnsrecord=www.example.com/1.2.3.4\n")
|
|
|
|
fmt.Fprintf(os.Stderr, " -listen on :53 as dns server, forward dns requests to 8.8.8.8:53, return 1.2.3.4 when resolving www.example.com.\n")
|
|
|
|
fmt.Fprintf(os.Stderr, "\n")
|
2017-08-23 16:35:39 +08:00
|
|
|
}
|