support ebpf

This commit is contained in:
zhudan
2022-07-29 09:08:35 +08:00
parent 57a15088c2
commit 31f4d20477
30 changed files with 6270 additions and 8 deletions

20
constant/ebpf.go Normal file
View File

@ -0,0 +1,20 @@
package constant
import (
"net/netip"
"github.com/Dreamacro/clash/transport/socks5"
)
const (
BpfFSPath = "/sys/fs/bpf/clash"
TcpAutoRedirPort = 't'<<8 | 'r'<<0
ClashTrafficMark = 'c'<<24 | 'l'<<16 | 't'<<8 | 'm'<<0
)
type EBpf interface {
Start() error
Close()
Lookup(srcAddrPort netip.AddrPort) (socks5.Addr, error)
}