Chore: distinguish udp request in log (#449)

This commit is contained in:
gVisor bot 2019-12-25 12:01:48 +08:00
parent d240994896
commit 77b38b3285
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import (
)
var (
errIPNotFound = errors.New("cannot found ip")
errIPNotFound = errors.New("couldn't find ip")
errIPVersion = errors.New("ip version error")
)

View file

@ -182,7 +182,7 @@ func (t *Tunnel) handleUDPConn(localConn C.ServerAdapter) {
wg.Add(1)
proxy, rule, err := t.resolveMetadata(metadata)
if err != nil {
log.Warnln("Parse metadata failed: %s", err.Error())
log.Warnln("[UDP] Parse metadata failed: %s", err.Error())
t.natTable.Delete(lockKey)
wg.Done()
return
@ -190,7 +190,7 @@ func (t *Tunnel) handleUDPConn(localConn C.ServerAdapter) {
rawPc, nAddr, err := proxy.DialUDP(metadata)
if err != nil {
log.Warnln("dial %s error: %s", proxy.Name(), err.Error())
log.Warnln("[UDP] dial %s error: %s", proxy.Name(), err.Error())
t.natTable.Delete(lockKey)
wg.Done()
return
@ -199,9 +199,9 @@ func (t *Tunnel) handleUDPConn(localConn C.ServerAdapter) {
pc = newUDPTracker(rawPc, DefaultManager, metadata, rule)
if rule != nil {
log.Infoln("%s --> %v match %s using %s", metadata.SrcIP.String(), metadata.String(), rule.RuleType().String(), rawPc.Chains().String())
log.Infoln("[UDP] %s --> %v match %s using %s", metadata.SrcIP.String(), metadata.String(), rule.RuleType().String(), rawPc.Chains().String())
} else {
log.Infoln("%s --> %v doesn't match any rule using DIRECT", metadata.SrcIP.String(), metadata.String())
log.Infoln("[UDP] %s --> %v doesn't match any rule using DIRECT", metadata.SrcIP.String(), metadata.String())
}
t.natTable.Set(key, pc, addr)