Skip to content

Commit

Permalink
chore: doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nadoo committed Mar 14, 2022
1 parent 420ec26 commit 3740375
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 21 deletions.
52 changes: 42 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ glider 0.16.0, https://github.com/nadoo/glider ([email protected])
<summary><code>glider -scheme all</code></summary>
```bash
Http scheme:
http://[user:pass@]host:port

--
KCP scheme:
kcp://CRYPT:KEY@host:port[?dataShards=NUM&parityShards=NUM&mode=MODE]

Expand All @@ -240,10 +244,6 @@ Available crypt types for KCP:
Available modes for KCP:
fast, fast2, fast3, normal, default: fast

--
Socks5 scheme:
socks://[user:pass@]host:port

--
Simple-Obfs scheme:
simple-obfs://host:port[?type=TYPE&host=HOST&uri=URI&ua=UA]
Expand All @@ -255,6 +255,14 @@ Available types for simple-obfs:
Smux scheme:
smux://host:port

--
Socks4 scheme:
socks4://host:port

--
Socks5 scheme:
socks5://[user:pass@]host:port

--
SS scheme:
ss://method:pass@host:port
Expand All @@ -265,7 +273,7 @@ SS scheme:
Stream Ciphers:
AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5
Alias:
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305
Plain: NONE

--
Expand Down Expand Up @@ -305,6 +313,10 @@ Trojan server scheme:
trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
trojanc://pass@host:port[?fallback=127.0.0.1] (cleartext, without TLS)

--
Unix domain socket scheme:
unix://path

--
VLESS scheme:
vless://uuid@host:port[?fallback=127.0.0.1:80]
Expand Down Expand Up @@ -392,18 +404,38 @@ Examples:
## Service
- dhcpd / dhcpd-failover:
- dhcpd / dhcpd-failover:
- service=dhcpd,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
- service=dhcpd-failover,INTERFACE,START_IP,END_IP,LEASE_MINUTES[,MAC=IP,MAC=IP...]
- service=dhcpd,eth1,192.168.1.100,192.168.1.199,720
- service=dhcpd-failover,eth2,192.168.2.100,192.168.2.199,720,fc:23:34:9e:25:01=192.168.2.101
- service=dhcpd,eth1,192.168.1.100,192.168.1.199,720,fc:23:34:9e:25:01=192.168.1.101
- service=dhcpd-failover,eth2,192.168.2.100,192.168.2.199,720
- note: `dhcpd-failover` only serves requests when there's no other dhcp server exists in lan
- detect interval: 1min
## Linux Service
- systemd: [https://github.com/nadoo/glider/blob/master/systemd/](https://github.com/nadoo/glider/blob/master/systemd/)
- <details> <summary>docker: click to see details</summary>
- run glider
```
docker run -d --name glider --net host --restart=always -v /etc/glider:/etc/glider nadoo/glider:latest -config=/etc/glider/glider.conf
```
- run watchtower(if you need auto update for glider)
```
docker run -d --name watchtower --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower \
--interval 21600 --cleanup true glider
```
- open udp ports(if you need nat fullcone)
```
iptables -A INPUT -p udp -m udp --dport 1024:65535 -j ACCEPT
```
</details>
## Customize Build
<details><summary>You can customize and build glider if you want a smaller binary (click to see details)</summary>
Expand All @@ -425,7 +457,7 @@ Examples:
go build -v -ldflags "-s -w"
```

</details>
</details>

## Proxy & Protocol Chains
<details><summary>In glider, you can easily chain several proxy servers or protocols together (click to see details)</summary>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/dgryski/go-rc2 v0.0.0-20150621095337-8a9021637152
github.com/insomniacslk/dhcp v0.0.0-20220119180841-3c283ff8b7dd
github.com/nadoo/conflag v0.3.1
github.com/nadoo/ipset v0.4.1-0.20220218075046-ca3cdce74266
github.com/nadoo/ipset v0.5.0
github.com/xtaci/kcp-go/v5 v5.6.1
golang.org/x/crypto v0.0.0-20220313003712-b769efc7c000
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ github.com/mdlayher/socket v0.2.1/go.mod h1:QLlNPkFR88mRUNQIzRBMfXxwKal8H7u1h3bL
github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104/go.mod h1:wqKykBG2QzQDJEzvRkcS8x6MiSJkF52hXZsXcjaB3ls=
github.com/nadoo/conflag v0.3.1 h1:4pHkLIz8PUsfg6ajNYRRSY3bt6m2LPsu6KOzn5uIXQw=
github.com/nadoo/conflag v0.3.1/go.mod h1:dzFfDUpXdr2uS2oV+udpy5N2vfNOu/bFzjhX1WI52co=
github.com/nadoo/ipset v0.4.1-0.20220218075046-ca3cdce74266 h1:lv9VKGAyAQAyS3lQoznfWoXYJD2C8/PITORX5r7f5rk=
github.com/nadoo/ipset v0.4.1-0.20220218075046-ca3cdce74266/go.mod h1:rYF5DQLRGGoQ8ZSWeK+6eX5amAuPqwFkWjhQlEITGJQ=
github.com/nadoo/ipset v0.5.0 h1:5GJUAuZ7ITQQQGne5J96AmFjRtI8Avlbk6CabzYWVUc=
github.com/nadoo/ipset v0.5.0/go.mod h1:rYF5DQLRGGoQ8ZSWeK+6eX5amAuPqwFkWjhQlEITGJQ=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
7 changes: 7 additions & 0 deletions proxy/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,10 @@ func extractUserPass(auth string) (username, password string, ok bool) {

return s[:idx], s[idx+1:], true
}

func init() {
proxy.AddUsage("http", `
Http scheme:
http://[user:pass@]host:port
`)
}
16 changes: 9 additions & 7 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ type Proxy interface {
Record(dialer Dialer, success bool)
}

var usages = make(map[string]string)
var (
msg strings.Builder
usages = make(map[string]string)
)

// AddUsage adds help message for the named proxy.
func AddUsage(name, usage string) { usages[name] = usage }
func AddUsage(name, usage string) {
usages[name] = usage
msg.WriteString(usage)
msg.WriteString("\n--")
}

// Usage returns help message of the named proxy.
func Usage(name string) string {
if name == "all" {
var msg strings.Builder
for _, usage := range usages {
msg.WriteString(usage)
msg.WriteString("\n--")
}
return msg.String()
}

Expand Down
7 changes: 7 additions & 0 deletions proxy/socks4/socks4.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,10 @@ func (s *SOCKS4) connect(conn net.Conn, target string) error {

return err
}

func init() {
proxy.AddUsage("socks4", `
Socks4 scheme:
socks4://host:port
`)
}
2 changes: 1 addition & 1 deletion proxy/socks5/socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ func NewSocks5(s string, d proxy.Dialer, p proxy.Proxy) (*Socks5, error) {
func init() {
proxy.AddUsage("socks5", `
Socks5 scheme:
socks://[user:pass@]host:port
socks5://[user:pass@]host:port
`)
}

0 comments on commit 3740375

Please sign in to comment.