mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 09:25:41 +08:00
obfs: compatible with some server implementation in tls mode
This commit is contained in:
parent
51fedc8653
commit
6ba9e1f5e8
@ -338,7 +338,7 @@ Examples:
|
||||
- [transparent proxy with dnsmasq](config/examples/8.transparent_proxy_with_dnsmasq)
|
||||
- [transparent proxy without dnsmasq](config/examples/9.transparent_proxy_without_dnsmasq)
|
||||
|
||||
### Forwarder Chain
|
||||
### Proxy & Protocol Chain
|
||||
In glider, you can easily chain several proxy servers or protocols together, e.g:
|
||||
|
||||
- Chain proxy servers:
|
||||
|
@ -32,7 +32,9 @@ func NewServer(addr string, dialer proxy.Dialer, config *Config) (*Server, error
|
||||
return s, err
|
||||
}
|
||||
|
||||
// Start .
|
||||
// Start starts the dns forwarding server
|
||||
// We use WaitGroup here to ensure both udp and tcp serer are completly running,
|
||||
// so we can start any other services later, since they may rely on dns service.
|
||||
func (s *Server) Start() {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
2
main.go
2
main.go
@ -29,7 +29,7 @@ import (
|
||||
)
|
||||
|
||||
// VERSION .
|
||||
const VERSION = "0.6.10"
|
||||
const VERSION = "0.6.11"
|
||||
|
||||
func main() {
|
||||
// read configs
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -176,7 +177,17 @@ func clientHello() *bytes.Buffer {
|
||||
|
||||
// Random
|
||||
// https://tools.ietf.org/id/draft-mathewson-no-gmtunixtime-00.txt
|
||||
random := make([]byte, 32)
|
||||
// NOTE:
|
||||
// Most tls implementations do not deal with the first 4 bytes unix time,
|
||||
// clients do not send current time, and server do not check it,
|
||||
// golang tls client and chrome browser send random bytes instead.
|
||||
//
|
||||
binary.Write(buf, binary.BigEndian, uint32(time.Now().Unix()))
|
||||
random := make([]byte, 28)
|
||||
// The above 2 lines of codes was added to make it compatible with some server implementation,
|
||||
// if we don't need the compatibility, just use the following code instead.
|
||||
// random := make([]byte, 32)
|
||||
|
||||
rand.Read(random)
|
||||
buf.Write(random)
|
||||
|
||||
|
@ -132,10 +132,10 @@ func (d *Dialer) NextDialer(dstAddr string) proxy.Dialer {
|
||||
return d.nextForwarder(dstAddr)
|
||||
}
|
||||
|
||||
// Priority returns the active priority of rrDialer
|
||||
// Priority returns the active priority of dialer
|
||||
func (d *Dialer) Priority() uint32 { return atomic.LoadUint32(&d.priority) }
|
||||
|
||||
// SetPriority sets the active priority of rrDialer
|
||||
// SetPriority sets the active priority of daler
|
||||
func (d *Dialer) SetPriority(p uint32) { atomic.StoreUint32(&d.priority, p) }
|
||||
|
||||
// initAvailable traverse d.fwdrs and init the available forwarder slice
|
||||
|
Loading…
Reference in New Issue
Block a user