Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>

This commit is contained in:
arraykeys@gmail.com
2018-04-18 15:27:32 +08:00
parent 27896a0563
commit 1597363dd1

View File

@ -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()
} }