chore:merge & adjust code

This commit is contained in:
Meta
2022-04-12 20:20:04 +08:00
parent 173e10abe6
commit ce96ac35fb
4 changed files with 22 additions and 18 deletions

View File

@ -247,7 +247,7 @@ func handleUDPConn(packet *inbound.PacketAdapter) {
ctx, cancel := context.WithTimeout(context.Background(), C.DefaultUDPTimeout)
defer cancel()
rawPc, err := proxy.ListenPacketContext(ctx, metadata.Pure())
rawPc, err := proxy.ListenPacketContext(ctx, metadata)
if err != nil {
if rule == nil {
log.Warnln("[UDP] dial %s to %s error: %s", proxy.Name(), metadata.RemoteAddress(), err.Error())
@ -309,7 +309,9 @@ func handleTCPConn(connCtx C.ConnContext) {
return
}
remoteConn, err := proxy.DialContext(ctx, metadata.Pure())
ctx, cancel := context.WithTimeout(context.Background(), C.DefaultTCPTimeout)
defer cancel()
remoteConn, err := proxy.DialContext(ctx, metadata)
if err != nil {
if rule == nil {
log.Warnln("[TCP] dial %s to %s error: %s", proxy.Name(), metadata.RemoteAddress(), err.Error())