修复合并企业版遗留的一些bug.
This commit is contained in:
@ -92,7 +92,7 @@ func (s *DNS) InitService() (err error) {
|
|||||||
nil,
|
nil,
|
||||||
&net.Dialer{
|
&net.Dialer{
|
||||||
Timeout: 5 * time.Second,
|
Timeout: 5 * time.Second,
|
||||||
KeepAlive: 5 * time.Second,
|
KeepAlive: 2 * time.Second,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -133,7 +133,7 @@ func (s *DNS) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop dns service crashed,%s", e)
|
s.log.Printf("stop dns service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service dns stoped")
|
s.log.Printf("service dns stopped")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
Stop(s.serviceKey)
|
Stop(s.serviceKey)
|
||||||
|
|||||||
@ -85,8 +85,8 @@ func StartWithLog(serviceID, serviceArgsStr string, loggerCallback LogCallback)
|
|||||||
nolog := app.Flag("nolog", "turn off logging").Default("false").Bool()
|
nolog := app.Flag("nolog", "turn off logging").Default("false").Bool()
|
||||||
kcpArgs.Key = app.Flag("kcp-key", "pre-shared secret between client and server").Default("secrect").String()
|
kcpArgs.Key = app.Flag("kcp-key", "pre-shared secret between client and server").Default("secrect").String()
|
||||||
kcpArgs.Crypt = app.Flag("kcp-method", "encrypt/decrypt method, can be: aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none").Default("aes").Enum("aes", "aes-128", "aes-192", "salsa20", "blowfish", "twofish", "cast5", "3des", "tea", "xtea", "xor", "sm4", "none")
|
kcpArgs.Crypt = app.Flag("kcp-method", "encrypt/decrypt method, can be: aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none").Default("aes").Enum("aes", "aes-128", "aes-192", "salsa20", "blowfish", "twofish", "cast5", "3des", "tea", "xtea", "xor", "sm4", "none")
|
||||||
kcpArgs.Mode = app.Flag("kcp-mode", "profiles: fast3, fast2, fast, normal, manual").Default("fast").Enum("fast3", "fast2", "fast", "normal", "manual")
|
kcpArgs.Mode = app.Flag("kcp-mode", "profiles: fast3, fast2, fast, normal, manual").Default("fast3").Enum("fast3", "fast2", "fast", "normal", "manual")
|
||||||
kcpArgs.MTU = app.Flag("kcp-mtu", "set maximum transmission unit for UDP packets").Default("450").Int()
|
kcpArgs.MTU = app.Flag("kcp-mtu", "set maximum transmission unit for UDP packets").Default("1350").Int()
|
||||||
kcpArgs.SndWnd = app.Flag("kcp-sndwnd", "set send window size(num of packets)").Default("1024").Int()
|
kcpArgs.SndWnd = app.Flag("kcp-sndwnd", "set send window size(num of packets)").Default("1024").Int()
|
||||||
kcpArgs.RcvWnd = app.Flag("kcp-rcvwnd", "set receive window size(num of packets)").Default("1024").Int()
|
kcpArgs.RcvWnd = app.Flag("kcp-rcvwnd", "set receive window size(num of packets)").Default("1024").Int()
|
||||||
kcpArgs.DataShard = app.Flag("kcp-ds", "set reed-solomon erasure coding - datashard").Default("10").Int()
|
kcpArgs.DataShard = app.Flag("kcp-ds", "set reed-solomon erasure coding - datashard").Default("10").Int()
|
||||||
|
|||||||
@ -238,7 +238,7 @@ func (s *HTTP) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop http(s) service crashed,%s", e)
|
s.log.Printf("stop http(s) service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service http(s) stoped")
|
s.log.Printf("service http(s) stopped")
|
||||||
}
|
}
|
||||||
s.basicAuth = utils.BasicAuth{}
|
s.basicAuth = utils.BasicAuth{}
|
||||||
s.cfg = HTTPArgs{}
|
s.cfg = HTTPArgs{}
|
||||||
@ -425,7 +425,7 @@ func (s *HTTP) OutToTCP(useProxy bool, address string, inConn *net.Conn, req *ut
|
|||||||
//https或者http,上级是代理,proxy需要转发
|
//https或者http,上级是代理,proxy需要转发
|
||||||
outConn.SetDeadline(time.Now().Add(time.Millisecond * time.Duration(*s.cfg.Timeout)))
|
outConn.SetDeadline(time.Now().Add(time.Millisecond * time.Duration(*s.cfg.Timeout)))
|
||||||
//直连目标或上级非代理或非SNI,,清理HTTP头部的代理头信息
|
//直连目标或上级非代理或非SNI,,清理HTTP头部的代理头信息
|
||||||
if !useProxy || *s.cfg.ParentType == "ssh" && !req.IsSNI {
|
if (!useProxy || *s.cfg.ParentType == "ssh") && !req.IsSNI {
|
||||||
_, err = outConn.Write(utils.RemoveProxyHeaders(req.HeadBuf))
|
_, err = outConn.Write(utils.RemoveProxyHeaders(req.HeadBuf))
|
||||||
} else {
|
} else {
|
||||||
_, err = outConn.Write(req.HeadBuf)
|
_, err = outConn.Write(req.HeadBuf)
|
||||||
|
|||||||
@ -81,7 +81,7 @@ func (s *MuxBridge) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop bridge service crashed,%s", e)
|
s.log.Printf("stop bridge service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service bridge stoped")
|
s.log.Printf("service bridge stopped")
|
||||||
}
|
}
|
||||||
s.cfg = MuxBridgeArgs{}
|
s.cfg = MuxBridgeArgs{}
|
||||||
s.clientControlConns = nil
|
s.clientControlConns = nil
|
||||||
|
|||||||
@ -111,7 +111,7 @@ func (s *MuxClient) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop client service crashed,%s", e)
|
s.log.Printf("stop client service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service client stoped")
|
s.log.Printf("service client stopped")
|
||||||
}
|
}
|
||||||
s.cfg = MuxClientArgs{}
|
s.cfg = MuxClientArgs{}
|
||||||
s.jumper = nil
|
s.jumper = nil
|
||||||
|
|||||||
@ -207,7 +207,7 @@ func (s *MuxServer) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop server service crashed,%s", e)
|
s.log.Printf("stop server service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service server stoped")
|
s.log.Printf("service server stopped")
|
||||||
}
|
}
|
||||||
s.cfg = MuxServerArgs{}
|
s.cfg = MuxServerArgs{}
|
||||||
s.jumper = nil
|
s.jumper = nil
|
||||||
|
|||||||
@ -230,7 +230,7 @@ func (s *Socks) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop socks service crashed,%s", e)
|
s.log.Printf("stop socks service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service socks stoped")
|
s.log.Printf("service socks stopped")
|
||||||
}
|
}
|
||||||
s.basicAuth = utils.BasicAuth{}
|
s.basicAuth = utils.BasicAuth{}
|
||||||
s.cfg = SocksArgs{}
|
s.cfg = SocksArgs{}
|
||||||
|
|||||||
@ -193,7 +193,7 @@ func (s *SPS) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop sps service crashed,%s", e)
|
s.log.Printf("stop sps service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service sps stoped")
|
s.log.Printf("service sps stopped")
|
||||||
}
|
}
|
||||||
s.basicAuth = utils.BasicAuth{}
|
s.basicAuth = utils.BasicAuth{}
|
||||||
s.cfg = SPSArgs{}
|
s.cfg = SPSArgs{}
|
||||||
@ -254,7 +254,7 @@ func (s *SPS) Start(args interface{}, log *logger.Logger) (err error) {
|
|||||||
err = sc.ListenTCP(s.callback)
|
err = sc.ListenTCP(s.callback)
|
||||||
} else if *s.cfg.LocalType == "tls" {
|
} else if *s.cfg.LocalType == "tls" {
|
||||||
err = sc.ListenTLS(s.cfg.CertBytes, s.cfg.KeyBytes, s.cfg.CaCertBytes, s.callback)
|
err = sc.ListenTLS(s.cfg.CertBytes, s.cfg.KeyBytes, s.cfg.CaCertBytes, s.callback)
|
||||||
} else if *s.cfg.LocalType == "tcp" {
|
} else if *s.cfg.LocalType == "kcp" {
|
||||||
err = sc.ListenKCP(s.cfg.KCP, s.callback, s.log)
|
err = sc.ListenKCP(s.cfg.KCP, s.callback, s.log)
|
||||||
}
|
}
|
||||||
if *s.cfg.ParentServiceType == "socks" {
|
if *s.cfg.ParentServiceType == "socks" {
|
||||||
|
|||||||
@ -100,7 +100,7 @@ func (s *TCP) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop tcp service crashed,%s", e)
|
s.log.Printf("stop tcp service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service tcp stoped")
|
s.log.Printf("service tcp stopped")
|
||||||
}
|
}
|
||||||
s.cfg = TCPArgs{}
|
s.cfg = TCPArgs{}
|
||||||
s.jumper = nil
|
s.jumper = nil
|
||||||
|
|||||||
@ -72,7 +72,7 @@ func (s *TunnelBridge) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop tbridge service crashed,%s", e)
|
s.log.Printf("stop tbridge service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service tbridge stoped")
|
s.log.Printf("service tbridge stopped")
|
||||||
}
|
}
|
||||||
s.cfg = TunnelBridgeArgs{}
|
s.cfg = TunnelBridgeArgs{}
|
||||||
s.clientControlConns = nil
|
s.clientControlConns = nil
|
||||||
|
|||||||
@ -95,7 +95,7 @@ func (s *TunnelClient) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop tclient service crashed,%s", e)
|
s.log.Printf("stop tclient service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service tclient stoped")
|
s.log.Printf("service tclient stopped")
|
||||||
}
|
}
|
||||||
s.cfg = TunnelClientArgs{}
|
s.cfg = TunnelClientArgs{}
|
||||||
s.ctrlConn = nil
|
s.ctrlConn = nil
|
||||||
|
|||||||
@ -176,7 +176,7 @@ func (s *TunnelServer) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop server service crashed,%s", e)
|
s.log.Printf("stop server service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service server stoped")
|
s.log.Printf("service server stopped")
|
||||||
}
|
}
|
||||||
s.cfg = TunnelServerArgs{}
|
s.cfg = TunnelServerArgs{}
|
||||||
s.jumper = nil
|
s.jumper = nil
|
||||||
|
|||||||
@ -94,7 +94,7 @@ func (s *UDP) StopService() {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
s.log.Printf("stop udp service crashed,%s", e)
|
s.log.Printf("stop udp service crashed,%s", e)
|
||||||
} else {
|
} else {
|
||||||
s.log.Printf("service udp stoped")
|
s.log.Printf("service udp stopped")
|
||||||
}
|
}
|
||||||
s.cfg = UDPArgs{}
|
s.cfg = UDPArgs{}
|
||||||
s.log = nil
|
s.log = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user