no message
This commit is contained in:
@ -602,6 +602,7 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if *s.cfg.Parent != "" {
|
if *s.cfg.Parent != "" {
|
||||||
|
//parent proxy
|
||||||
outconn, err := s.getOutConn(nil, nil, "", false)
|
outconn, err := s.getOutConn(nil, nil, "", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
clean("connnect fail", fmt.Sprintf("%s", err))
|
clean("connnect fail", fmt.Sprintf("%s", err))
|
||||||
@ -625,6 +626,7 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
|
|||||||
s.log.Printf("parent udp address %s", client.UDPAddr)
|
s.log.Printf("parent udp address %s", client.UDPAddr)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
//local proxy
|
||||||
for {
|
for {
|
||||||
buf := utils.LeakyBuffer.Get()
|
buf := utils.LeakyBuffer.Get()
|
||||||
defer utils.LeakyBuffer.Put(buf)
|
defer utils.LeakyBuffer.Put(buf)
|
||||||
@ -652,9 +654,10 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
s.udpRelatedPacketConns.Set(srcAddr.String(), outUDPConn)
|
s.udpRelatedPacketConns.Set(srcAddr.String(), outUDPConn)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer s.udpRelatedPacketConns.Remove(srcAddr.String())
|
defer s.udpRelatedPacketConns.Remove(srcAddr.String())
|
||||||
//bind
|
//out->local io copy
|
||||||
buf := utils.LeakyBuffer.Get()
|
buf := utils.LeakyBuffer.Get()
|
||||||
defer utils.LeakyBuffer.Put(buf)
|
defer utils.LeakyBuffer.Put(buf)
|
||||||
for {
|
for {
|
||||||
@ -685,6 +688,7 @@ func (s *Socks) proxyUDP(inConn *net.Conn, methodReq socks.MethodsRequest, reque
|
|||||||
} else {
|
} else {
|
||||||
outUDPConn = v.(*net.UDPConn)
|
outUDPConn = v.(*net.UDPConn)
|
||||||
}
|
}
|
||||||
|
//local->out io copy
|
||||||
_, err = outUDPConn.Write(p.Data())
|
_, err = outUDPConn.Write(p.Data())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if isClosedErr(err) {
|
if isClosedErr(err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user