github.com/kelleygo/clashcore@v1.0.2/component/ebpf/ebpf.go (about) 1 package ebpf 2 3 import ( 4 "net/netip" 5 6 C "github.com/kelleygo/clashcore/constant" 7 "github.com/kelleygo/clashcore/transport/socks5" 8 ) 9 10 type TcEBpfProgram struct { 11 pros []C.EBpf 12 rawNICs []string 13 } 14 15 func (t *TcEBpfProgram) RawNICs() []string { 16 return t.rawNICs 17 } 18 19 func (t *TcEBpfProgram) Close() { 20 for _, p := range t.pros { 21 p.Close() 22 } 23 } 24 25 func (t *TcEBpfProgram) Lookup(srcAddrPort netip.AddrPort) (addr socks5.Addr, err error) { 26 for _, p := range t.pros { 27 addr, err = p.Lookup(srcAddrPort) 28 if err == nil { 29 return 30 } 31 } 32 return 33 }