mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 01:15:41 +08:00
doc: add info for customize building
This commit is contained in:
parent
edfca215c5
commit
bc68535dcd
32
README.md
32
README.md
@ -71,15 +71,9 @@ we can set up local listeners as proxy servers, and forward requests to internet
|
||||
|
||||
## Install
|
||||
|
||||
Binary Download:
|
||||
Download:
|
||||
- [https://github.com/nadoo/glider/releases](https://github.com/nadoo/glider/releases)
|
||||
|
||||
Build from source code (requires **Go 1.15+** ):
|
||||
```bash
|
||||
git clone https://github.com/nadoo/glider
|
||||
cd glider && go build
|
||||
```
|
||||
|
||||
ArchLinux:
|
||||
```bash
|
||||
sudo pacman -S glider
|
||||
@ -371,9 +365,7 @@ glider -config CONFIGPATH -listen :8080 -verbose
|
||||
|
||||
## Service
|
||||
|
||||
#### Scheme:
|
||||
|
||||
```service=SERVICE_NAME[,SERVICE_CONFIG]```
|
||||
**Scheme:** ```service=SERVICE_NAME[,SERVICE_CONFIG]```
|
||||
|
||||
- dhcpd:
|
||||
- service=dhcpd,INTERFACE,START_IP,END_IP
|
||||
@ -383,6 +375,26 @@ glider -config CONFIGPATH -listen :8080 -verbose
|
||||
|
||||
- systemd: [https://github.com/nadoo/glider/blob/master/systemd/](https://github.com/nadoo/glider/blob/master/systemd/)
|
||||
|
||||
## Customize Build
|
||||
|
||||
You can customize and build glider by yourself if you want a smaller binary.
|
||||
|
||||
1. Clone the source code:
|
||||
```bash
|
||||
git clone https://github.com/nadoo/glider
|
||||
```
|
||||
2. Customize features:
|
||||
|
||||
```open `feature.go` & `feature_linux.go`, comment out the packages you don't need```
|
||||
```bash
|
||||
// _ "github.com/nadoo/glider/proxy/kcp"
|
||||
```
|
||||
|
||||
3. Build it(requires **Go 1.15+** )
|
||||
```bash
|
||||
cd glider && go build
|
||||
```
|
||||
|
||||
## Links
|
||||
|
||||
- [ipset](https://github.com/nadoo/ipset): netlink ipset package for Go.
|
||||
|
@ -17,7 +17,7 @@ type TLS struct {
|
||||
proxy proxy.Proxy
|
||||
addr string
|
||||
|
||||
tlsConfig *stdtls.Config
|
||||
config *stdtls.Config
|
||||
|
||||
serverName string
|
||||
skipVerify bool
|
||||
@ -83,7 +83,7 @@ func NewTLSDialer(s string, d proxy.Dialer) (proxy.Dialer, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.tlsConfig = &stdtls.Config{
|
||||
p.config = &stdtls.Config{
|
||||
ServerName: p.serverName,
|
||||
InsecureSkipVerify: p.skipVerify,
|
||||
ClientSessionCache: stdtls.NewLRUClientSessionCache(64),
|
||||
@ -114,7 +114,7 @@ func NewTLSServer(s string, p proxy.Proxy) (proxy.Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
t.tlsConfig = &stdtls.Config{
|
||||
t.config = &stdtls.Config{
|
||||
Certificates: []stdtls.Certificate{cert},
|
||||
MinVersion: stdtls.VersionTLS12,
|
||||
}
|
||||
@ -155,7 +155,7 @@ func (s *TLS) Serve(c net.Conn) {
|
||||
// defer c.Close()
|
||||
|
||||
if s.server != nil {
|
||||
cc := stdtls.Server(c, s.tlsConfig)
|
||||
cc := stdtls.Server(c, s.config)
|
||||
s.server.Serve(cc)
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ func (s *TLS) Dial(network, addr string) (net.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c := stdtls.Client(cc, s.tlsConfig)
|
||||
c := stdtls.Client(cc, s.config)
|
||||
err = c.Handshake()
|
||||
return c, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user