diff --git a/Makefile b/Makefile index c507e0d..d630651 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ # Pin the default clang to a stable version. CLANG ?= clang STRIP ?= llvm-strip -#CFLAGS := -O2 -g -Wall -Werror $(CFLAGS) CFLAGS := -O2 -Wall -Werror $(CFLAGS) # Get version from .git. @@ -16,15 +15,15 @@ date=$(shell git log -1 --format="%cd" --date=short | sed s/-//g) count=$(shell git rev-list --count HEAD) commit=$(shell git rev-parse --short HEAD) ifeq ($(wildcard .git/.),) - version=unstable-0.nogit + VERSION ?= unstable-0.nogit else - version=unstable-$(date).r$(count).$(commit) + VERSION ?= unstable-$(date).r$(count).$(commit) endif .PHONY: ebpf dae dae: ebpf - go build -ldflags "-s -w -X github.com/v2rayA/dae/cmd.Version=$(version)" . + go build -ldflags "-s -w -X github.com/v2rayA/dae/cmd.Version=$(VERSION)" . # $BPF_CLANG is used in go:generate invocations. ebpf: export BPF_CLANG := $(CLANG) diff --git a/component/control/bpf_utils.go b/component/control/bpf_utils.go index 3f266a2..ad3a3ef 100644 --- a/component/control/bpf_utils.go +++ b/component/control/bpf_utils.go @@ -54,17 +54,6 @@ func cidrToBpfLpmKey(prefix netip.Prefix) _bpfLpmKey { } } -// A utility to convert the values to proper strings. -func int8ToStr(arr []int8) string { - b := make([]byte, 0, len(arr)) - for _, v := range arr { - if v == 0x00 { - break - } - b = append(b, byte(v)) - } - return string(b) -} func BatchUpdate(m *ebpf.Map, keys interface{}, values interface{}, opts *ebpf.BatchOptions) (n int, err error) { var old bool version, e := internal.KernelVersion() diff --git a/component/control/kern/tproxy.c b/component/control/kern/tproxy.c index 1926cda..2e94c71 100644 --- a/component/control/kern/tproxy.c +++ b/component/control/kern/tproxy.c @@ -966,7 +966,6 @@ int tproxy_ingress(struct __sk_buff *skb) { key_src.port = tcph->source; key_src.proto = l4_proto; __u8 outbound; - // No record. No DNS requests before. if (unlikely(tcp_state_syn)) { // New TCP connection. // bpf_printk("[%X]New Connection", bpf_ntohl(tcph->seq));