From 92d99d923caed54c2fe9d2955b956329b1fe0b47 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Sun, 23 Jul 2017 01:46:06 +0800 Subject: [PATCH] added more info to config example --- README.md | 18 ++++----- glider.conf.example | 94 +++++++++++++++++++++++++++++++++++++++++++++ glider.conf.sample | 35 ----------------- main.go | 7 ++++ 4 files changed, 109 insertions(+), 45 deletions(-) create mode 100644 glider.conf.example delete mode 100644 glider.conf.sample diff --git a/README.md b/README.md index 8403177..2e7a849 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,12 @@ Available forward strategies: rr: Round Robin mode ha: High Availability mode +Config file format(see `glider.conf.example` as an example): + # COMMENT LINE + KEY=VALUE + KEY=VALUE + # KEY equals to command line flag name: listen forward strategy... + Examples: glider -config glider.conf -run glider with specified config file. @@ -110,14 +116,6 @@ verbose # listen on 8443, serve as http/socks5 proxy on the same port. listen=:8443 -# listen on 8443 as a ss server. -# listen=ss://AEAD_CHACHA20_POLY1305:pass@:8443 - -# listen=http://:8080 -# listen=socks5://:1080 -# listen=redir://:1081 -# listen=tcptun://:8080=1.1.1.1:80 - # listen on udp port 53, forward dns requests via tcp protocol listen=dnstun://:53=8.8.8.8:53 @@ -138,7 +136,7 @@ checkhost=www.apple.com:443 # check duration checkduration=30 ``` - +See [glider.conf.example](https://github.com/nadoo/glider/blob/master/glider.conf.example) ## Service ```bash @@ -178,4 +176,4 @@ systemctl start glider.service - [go-ss2](https://github.com/shadowsocks/go-shadowsocks2): the core ss protocol support - [gost](https://github.com/ginuerzh/gost): ideas and inspirations - [conflag](https://github.com/nadoo/conflag): command line and config file parse support -- [ArchLinux](https://www.archlinux.org): [https://www.archlinux.org/packages/community/x86_64/glider/](https://www.archlinux.org/packages/community/x86_64/glider/) +- [ArchLinux](https://www.archlinux.org/packages/community/x86_64/glider): a great linux distribution with glider pre-built package diff --git a/glider.conf.example b/glider.conf.example new file mode 100644 index 0000000..f4a7565 --- /dev/null +++ b/glider.conf.example @@ -0,0 +1,94 @@ +########################################## +# __ _ _ ___ ____ ___ +# / /`_ | | | | | | \ | |_ | |_) +# \_\_/ |_|__ |_| |_|_/ |_|__ |_| \ +# +# Glider is a forward proxy with several protocols support. +# +# You can set up local listeners as proxy, and forward requests to internet via forwarders. +# +# |Forwarder ----------------->| +# Listener --> | | Internet +# |Forwarder,Forwarder...----->| +# +# ----------------------------------------------------------- +# +# This is a sample configuration file for glider. +# +# Format is one option per line, legal options are the same +# as the options legal on the command line. See "glider -help" for details. +# +# Comment line starts with "#", values set in the format: +# KEY=VALUE +# +# ----------------------------------------------------------- + +# Verbose mode, print logs +verbose=True + +# LISTENERS +# --------- +# Local listeners, we can set up multiple listeners on different port with +# different protocols. + +# listen on 8443, serve as http/socks5 proxy on the same port. +listen=:8443 + +# listen on 8448 as a ss server. +# listen=ss://AEAD_CHACHA20_POLY1305:pass@:8448 + +# listen on 8080 as a http proxy server. +listen=http://:8080 + +# listen on 1080 as a socks5 proxy server. +listen=socks5://:1080 + +# listen on 1081 as a linux transparent proxy server. +# listen=redir://:1081 + +# listen on 1082 as a tcp tunnel, all requests to :1082 will be forward to 1.1.1.1:80 +# listen=tcptun://:1082=1.1.1.1:80 + +# listen on udp port 53, act as a local dns server, +# forward all requests to 8.8.8.8:53 via tcp protocol, + + +# FORWARDERS +# ---------- +# Forwarders, we can setup multiple forwarders. + +# Socks5 proxy as forwarder +#forward=socks5://192.168.1.10:1080 + +# SS proxy as forwarder +# forward=ss://method:pass@1.1.1.1:443 + +# http proxy as forwarder +# forward=http://1.1.1.1:8080 + + +# FORWARDER CHAIN +# --------------- +# We can setup a forward chain using 1 forward option, +# use comma to separate different upstream forward proxies. +#forward=http://1.1.1.1:8080,socks5://2.2.2.2:1080 + +# FORWARDE STRATEGY +# ----------------- +# If we set up multiple forwarders, we can use them in our own strategy. + +# Round Robin mode: rr +# High Availability mode: ha +strategy=rr + + +# FORWARDERS CHECK +# ---------------- +# We can check whether a forwarder is available. + +# Used to connect via forwarders, if the host is unreachable, the forwarder +# will be set to disabled. +checkhost=www.apple.com:443 + +# check duration(seconds) +checkduration=30 diff --git a/glider.conf.sample b/glider.conf.sample deleted file mode 100644 index 3e62e9b..0000000 --- a/glider.conf.sample +++ /dev/null @@ -1,35 +0,0 @@ -### glider config file - -# verbose mode, print logs -verbose - -# listen on 8443, serve as http/socks5 proxy on the same port. -listen=:8443 - -# listen on 8443 as a ss server. -# listen=ss://AEAD_CHACHA20_POLY1305:pass@:8443 - -# listen=http://:8080 -# listen=socks5://:1080 -# listen=redir://:1081 -# listen=tcptun://:8080=1.1.1.1:80 - -# listen on udp port 53, forward dns requests via tcp protocol -listen=dnstun://:53=8.8.8.8:53 - -# upstream forward proxy -forward=socks5://192.168.1.10:1080 - -# upstream forward proxy -forward=ss://method:pass@1.1.1.1:443 - -# upstream forward proxy (forward chain) -forward=http://1.1.1.1:8080,socks5://2.2.2.2:1080 - -# multiple upstream proxies forwad strategy -strategy=rr - -# check address (to check a whether a forward proxy) -checkhost=www.apple.com:443 -# check duration -checkduration=30 diff --git a/main.go b/main.go index fbc03c8..9d8ebf8 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,13 @@ func usage() { fmt.Fprintf(os.Stderr, " ha: High Availability mode\n") 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")