mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-09 07:19:17 +07:00
feat: new log formatter
This commit is contained in:
@ -8,6 +8,7 @@ package control
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mzz2017/softwind/pkg/zeroalloc/io"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/v2rayA/dae/common"
|
||||
"github.com/v2rayA/dae/common/consts"
|
||||
internal "github.com/v2rayA/dae/pkg/ebpf_internal"
|
||||
@ -48,7 +49,10 @@ func (c *ControlPlane) handleConn(lConn net.Conn) (err error) {
|
||||
outbound := c.outbounds[value.Outbound]
|
||||
// TODO: Set-up ip to domain mapping and show domain if possible.
|
||||
src := lConn.RemoteAddr().(*net.TCPAddr).AddrPort()
|
||||
c.log.Infof("TCP: %v <-[%v]-> %v", RefineSourceToShow(src, dst.Addr()), outbound.Name, RefineAddrPortToShow(dst))
|
||||
c.log.WithFields(logrus.Fields{
|
||||
"l4proto": "TCP",
|
||||
"outbound": outbound.Name,
|
||||
}).Infof("%v <-> %v", RefineSourceToShow(src, dst.Addr()), RefineAddrPortToShow(dst))
|
||||
if value.Outbound < 0 || int(value.Outbound) >= len(c.outbounds) {
|
||||
return fmt.Errorf("outbound id from bpf is out of range: %v not in [0, %v]", value.Outbound, len(c.outbounds)-1)
|
||||
}
|
||||
|
@ -141,8 +141,11 @@ func (c *ControlPlane) handlePkt(data []byte, lConn *net.UDPConn, lAddrPort neti
|
||||
}
|
||||
} else {
|
||||
// TODO: Set-up ip to domain mapping and show domain if possible.
|
||||
c.log.Infof("UDP %v <-[%v]-> %v",
|
||||
RefineSourceToShow(lAddrPort, dest.Addr()), outbound.Name, RefineAddrPortToShow(dest),
|
||||
c.log.WithFields(logrus.Fields{
|
||||
"l4proto": "UDP",
|
||||
"outbound": outbound.Name,
|
||||
}).Infof("%v <-> %v",
|
||||
RefineSourceToShow(lAddrPort, dest.Addr()), RefineAddrPortToShow(dest),
|
||||
)
|
||||
}
|
||||
ue, err := DefaultUdpEndpointPool.GetOrCreate(lAddrPort, &UdpEndpointOptions{
|
||||
|
Reference in New Issue
Block a user