Merge branch 'dev' of github.com:snail007/goproxy into dev
* 'dev' of github.com:snail007/goproxy: fix #56 Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
This commit is contained in:
@ -75,7 +75,7 @@ func (s *SPS) InitOutConnPool() {
|
|||||||
0,
|
0,
|
||||||
*s.cfg.ParentType,
|
*s.cfg.ParentType,
|
||||||
s.cfg.KCP,
|
s.cfg.KCP,
|
||||||
s.cfg.CertBytes, s.cfg.KeyBytes, nil,
|
s.cfg.CertBytes, s.cfg.KeyBytes, s.cfg.CaCertBytes,
|
||||||
*s.cfg.Parent,
|
*s.cfg.Parent,
|
||||||
*s.cfg.Timeout,
|
*s.cfg.Timeout,
|
||||||
)
|
)
|
||||||
@ -120,7 +120,7 @@ func (s *SPS) Start(args interface{}) (err error) {
|
|||||||
if *s.cfg.LocalType == TYPE_TCP {
|
if *s.cfg.LocalType == TYPE_TCP {
|
||||||
err = sc.ListenTCP(s.callback)
|
err = sc.ListenTCP(s.callback)
|
||||||
} else if *s.cfg.LocalType == TYPE_TLS {
|
} else if *s.cfg.LocalType == TYPE_TLS {
|
||||||
err = sc.ListenTls(s.cfg.CertBytes, s.cfg.KeyBytes, nil, s.callback)
|
err = sc.ListenTls(s.cfg.CertBytes, s.cfg.KeyBytes, s.cfg.CaCertBytes, s.callback)
|
||||||
} else if *s.cfg.LocalType == TYPE_KCP {
|
} else if *s.cfg.LocalType == TYPE_KCP {
|
||||||
err = sc.ListenKCP(s.cfg.KCP, s.callback)
|
err = sc.ListenKCP(s.cfg.KCP, s.callback)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,17 @@ func (s *TunnelBridge) Start(args interface{}) (err error) {
|
|||||||
p, _ := strconv.Atoi(port)
|
p, _ := strconv.Atoi(port)
|
||||||
sc := utils.NewServerChannel(host, p)
|
sc := utils.NewServerChannel(host, p)
|
||||||
|
|
||||||
err = sc.ListenTls(s.cfg.CertBytes, s.cfg.KeyBytes, nil, func(inConn net.Conn) {
|
err = sc.ListenTls(s.cfg.CertBytes, s.cfg.KeyBytes, nil, s.callback)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Printf("proxy on tunnel bridge mode %s", (*sc.Listener).Addr())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (s *TunnelBridge) Clean() {
|
||||||
|
s.StopService()
|
||||||
|
}
|
||||||
|
func (s *TunnelBridge) callback(inConn net.Conn) {
|
||||||
//log.Printf("connection from %s ", inConn.RemoteAddr())
|
//log.Printf("connection from %s ", inConn.RemoteAddr())
|
||||||
|
|
||||||
reader := bufio.NewReader(inConn)
|
reader := bufio.NewReader(inConn)
|
||||||
@ -158,13 +168,4 @@ func (s *TunnelBridge) Start(args interface{}) (err error) {
|
|||||||
s.clientControlConns.Set(key, &inConn)
|
s.clientControlConns.Set(key, &inConn)
|
||||||
log.Printf("set client %s control conn", key)
|
log.Printf("set client %s control conn", key)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Printf("proxy on tunnel bridge mode %s", (*sc.Listener).Addr())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func (s *TunnelBridge) Clean() {
|
|
||||||
s.StopService()
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user