diff --git a/.gitignore b/.gitignore index 14dbd0c..d382f9d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.o bpf_bpfeb.go bpf_bpfel.go +dae diff --git a/Makefile b/Makefile index 49fec2a..92ccc88 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,16 @@ CLANG ?= clang STRIP ?= llvm-strip CFLAGS := -O2 -g -Wall -Werror $(CFLAGS) -.PHONY: generate +.PHONY: ebpf dae + +all: ebpf dae # $BPF_CLANG is used in go:generate invocations. -generate: export BPF_CLANG := $(CLANG) -generate: export BPF_STRIP := $(STRIP) -generate: export BPF_CFLAGS := $(CFLAGS) -generate: - go generate ./component/control/... \ No newline at end of file +ebpf: export BPF_CLANG := $(CLANG) +ebpf: export BPF_STRIP := $(STRIP) +ebpf: export BPF_CFLAGS := $(CFLAGS) +ebpf: + go generate ./component/control/... + +dae: ebpf + go build -ldflags "-s -w" . \ No newline at end of file diff --git a/component/control/control_plane.go b/component/control/control_plane.go index 1fbc202..eb119ba 100644 --- a/component/control/control_plane.go +++ b/component/control/control_plane.go @@ -9,12 +9,12 @@ import ( "context" "errors" "fmt" - "foo/common" - "foo/common/consts" - "foo/component/outbound" - "foo/component/outbound/dialer" - "foo/component/routing" - "foo/pkg/pool" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/component/outbound" + "github.com/v2rayA/dae/component/outbound/dialer" + "github.com/v2rayA/dae/component/routing" + "github.com/v2rayA/dae/pkg/pool" "github.com/cilium/ebpf" "github.com/cilium/ebpf/rlimit" "github.com/sirupsen/logrus" diff --git a/component/control/dns.go b/component/control/dns.go index 7112722..f9e1afc 100644 --- a/component/control/dns.go +++ b/component/control/dns.go @@ -7,8 +7,8 @@ package control import ( "fmt" - "foo/common" - "foo/common/consts" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/common/consts" "github.com/cilium/ebpf" "golang.org/x/net/dns/dnsmessage" "net/netip" diff --git a/component/control/match.go b/component/control/match.go index 2352cc8..5326a59 100644 --- a/component/control/match.go +++ b/component/control/match.go @@ -6,7 +6,7 @@ package control import ( - "foo/common/consts" + "github.com/v2rayA/dae/common/consts" "strings" ) diff --git a/component/control/routing_matcher_builder.go b/component/control/routing_matcher_builder.go index 8c1b49b..c958d9c 100644 --- a/component/control/routing_matcher_builder.go +++ b/component/control/routing_matcher_builder.go @@ -7,9 +7,9 @@ package control import ( "fmt" - "foo/common" - "foo/common/consts" - "foo/component/routing" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/component/routing" "github.com/cilium/ebpf" "net/netip" "strconv" diff --git a/component/control/tcp.go b/component/control/tcp.go index 68bece1..e8ff13a 100644 --- a/component/control/tcp.go +++ b/component/control/tcp.go @@ -9,8 +9,8 @@ import ( "encoding/binary" "errors" "fmt" - "foo/common" - "foo/common/consts" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/common/consts" "golang.org/x/sys/unix" "io" "net" diff --git a/component/control/udp.go b/component/control/udp.go index 5d88b2c..12f4e00 100644 --- a/component/control/udp.go +++ b/component/control/udp.go @@ -8,8 +8,8 @@ package control import ( "encoding/binary" "fmt" - "foo/common/consts" - "foo/pkg/pool" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/pkg/pool" "golang.org/x/net/dns/dnsmessage" "net" "net/netip" diff --git a/component/control/udp_endpoint.go b/component/control/udp_endpoint.go index 77f1a28..4d081f4 100644 --- a/component/control/udp_endpoint.go +++ b/component/control/udp_endpoint.go @@ -7,7 +7,7 @@ package control import ( "fmt" - "foo/pkg/pool" + "github.com/v2rayA/dae/pkg/pool" "golang.org/x/net/proxy" "net" "net/netip" diff --git a/component/control/utils.go b/component/control/utils.go index 06a6b1f..db7e271 100644 --- a/component/control/utils.go +++ b/component/control/utils.go @@ -6,7 +6,7 @@ package control import ( - "foo/common" + "github.com/v2rayA/dae/common" "github.com/cilium/ebpf" "net/netip" ) diff --git a/component/outbound/dialer/alive_dialer_set.go b/component/outbound/dialer/alive_dialer_set.go index cdb5bc2..bcf01ba 100644 --- a/component/outbound/dialer/alive_dialer_set.go +++ b/component/outbound/dialer/alive_dialer_set.go @@ -6,7 +6,7 @@ package dialer import ( - "foo/common/consts" + "github.com/v2rayA/dae/common/consts" "github.com/mzz2017/softwind/pkg/fastrand" "github.com/sirupsen/logrus" "sync" diff --git a/component/outbound/dialer/dialer.go b/component/outbound/dialer/dialer.go index 443b262..c62b9a1 100644 --- a/component/outbound/dialer/dialer.go +++ b/component/outbound/dialer/dialer.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "foo/common/consts" + "github.com/v2rayA/dae/common/consts" "github.com/mzz2017/softwind/pkg/fastrand" "github.com/sirupsen/logrus" "golang.org/x/net/proxy" diff --git a/component/outbound/dialer/http/http.go b/component/outbound/dialer/http/http.go index e5f698e..9588eb2 100644 --- a/component/outbound/dialer/http/http.go +++ b/component/outbound/dialer/http/http.go @@ -2,7 +2,7 @@ package http import ( "fmt" - "foo/component/outbound/dialer" + "github.com/v2rayA/dae/component/outbound/dialer" "github.com/mzz2017/softwind/protocol/http" "gopkg.in/yaml.v3" "net" diff --git a/component/outbound/dialer/shadowsocks/shadowsocks.go b/component/outbound/dialer/shadowsocks/shadowsocks.go index 3d62640..48a8ee8 100644 --- a/component/outbound/dialer/shadowsocks/shadowsocks.go +++ b/component/outbound/dialer/shadowsocks/shadowsocks.go @@ -3,9 +3,9 @@ package shadowsocks import ( "encoding/base64" "fmt" - "foo/common" - "foo/component/outbound/dialer" - "foo/component/outbound/dialer/transport/simpleobfs" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/component/outbound/dialer" + "github.com/v2rayA/dae/component/outbound/dialer/transport/simpleobfs" "github.com/mzz2017/softwind/protocol" "github.com/mzz2017/softwind/protocol/shadowsocks" "gopkg.in/yaml.v3" diff --git a/component/outbound/dialer/shadowsocksr/shadowsocksr.go b/component/outbound/dialer/shadowsocksr/shadowsocksr.go index 41b1c30..5f64792 100644 --- a/component/outbound/dialer/shadowsocksr/shadowsocksr.go +++ b/component/outbound/dialer/shadowsocksr/shadowsocksr.go @@ -3,8 +3,8 @@ package shadowsocksr import ( "encoding/base64" "fmt" - "foo/common" - "foo/component/outbound/dialer" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/component/outbound/dialer" ssr "github.com/v2rayA/shadowsocksR/client" "gopkg.in/yaml.v3" "net" diff --git a/component/outbound/dialer/socks/socks.go b/component/outbound/dialer/socks/socks.go index 6d61b21..2bc0057 100644 --- a/component/outbound/dialer/socks/socks.go +++ b/component/outbound/dialer/socks/socks.go @@ -2,7 +2,7 @@ package socks import ( "fmt" - "foo/component/outbound/dialer" + "github.com/v2rayA/dae/component/outbound/dialer" "github.com/nadoo/glider/proxy" "github.com/nadoo/glider/proxy/socks4" "github.com/nadoo/glider/proxy/socks5" diff --git a/component/outbound/dialer/trojan/trojan.go b/component/outbound/dialer/trojan/trojan.go index 8dd5ee8..3cff464 100644 --- a/component/outbound/dialer/trojan/trojan.go +++ b/component/outbound/dialer/trojan/trojan.go @@ -2,10 +2,10 @@ package trojan import ( "fmt" - "foo/common" - "foo/component/outbound/dialer" - "foo/component/outbound/dialer/transport/tls" - "foo/component/outbound/dialer/transport/ws" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/component/outbound/dialer" + "github.com/v2rayA/dae/component/outbound/dialer/transport/tls" + "github.com/v2rayA/dae/component/outbound/dialer/transport/ws" "github.com/mzz2017/softwind/protocol" "github.com/mzz2017/softwind/transport/grpc" "gopkg.in/yaml.v3" diff --git a/component/outbound/dialer/v2ray/v2ray.go b/component/outbound/dialer/v2ray/v2ray.go index b14e5a7..e5b4b60 100644 --- a/component/outbound/dialer/v2ray/v2ray.go +++ b/component/outbound/dialer/v2ray/v2ray.go @@ -3,10 +3,10 @@ package v2ray import ( "encoding/base64" "fmt" - "foo/common" - "foo/component/outbound/dialer" - "foo/component/outbound/dialer/transport/tls" - "foo/component/outbound/dialer/transport/ws" + "github.com/v2rayA/dae/common" + "github.com/v2rayA/dae/component/outbound/dialer" + "github.com/v2rayA/dae/component/outbound/dialer/transport/tls" + "github.com/v2rayA/dae/component/outbound/dialer/transport/ws" jsoniter "github.com/json-iterator/go" "github.com/mzz2017/softwind/protocol" "github.com/mzz2017/softwind/transport/grpc" diff --git a/component/outbound/dialer_group.go b/component/outbound/dialer_group.go index 697b367..63106cc 100644 --- a/component/outbound/dialer_group.go +++ b/component/outbound/dialer_group.go @@ -7,8 +7,8 @@ package outbound import ( "fmt" - "foo/common/consts" - "foo/component/outbound/dialer" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/component/outbound/dialer" "github.com/sirupsen/logrus" "golang.org/x/net/proxy" "net" diff --git a/component/outbound/dialer_group_test.go b/component/outbound/dialer_group_test.go index 942fa3d..b8aa704 100644 --- a/component/outbound/dialer_group_test.go +++ b/component/outbound/dialer_group_test.go @@ -6,9 +6,9 @@ package outbound import ( - "foo/common/consts" - "foo/component/outbound/dialer" - "foo/pkg/logger" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/component/outbound/dialer" + "github.com/v2rayA/dae/pkg/logger" "github.com/mzz2017/softwind/pkg/fastrand" "testing" "time" diff --git a/component/outbound/outbound.go b/component/outbound/outbound.go index d6c6132..240f6ea 100644 --- a/component/outbound/outbound.go +++ b/component/outbound/outbound.go @@ -6,12 +6,12 @@ package outbound import ( - _ "foo/component/outbound/dialer/http" - _ "foo/component/outbound/dialer/shadowsocks" - _ "foo/component/outbound/dialer/shadowsocksr" - _ "foo/component/outbound/dialer/socks" - _ "foo/component/outbound/dialer/trojan" - _ "foo/component/outbound/dialer/v2ray" + _ "github.com/v2rayA/dae/component/outbound/dialer/http" + _ "github.com/v2rayA/dae/component/outbound/dialer/shadowsocks" + _ "github.com/v2rayA/dae/component/outbound/dialer/shadowsocksr" + _ "github.com/v2rayA/dae/component/outbound/dialer/socks" + _ "github.com/v2rayA/dae/component/outbound/dialer/trojan" + _ "github.com/v2rayA/dae/component/outbound/dialer/v2ray" _ "github.com/mzz2017/softwind/protocol/shadowsocks" _ "github.com/mzz2017/softwind/protocol/trojanc" _ "github.com/mzz2017/softwind/protocol/vless" diff --git a/component/routing/matcher_builder.go b/component/routing/matcher_builder.go index 0166ae4..47e5985 100644 --- a/component/routing/matcher_builder.go +++ b/component/routing/matcher_builder.go @@ -7,12 +7,12 @@ package routing import ( "fmt" - consts2 "foo/common/consts" + "github.com/v2rayA/dae/common/consts" "net/netip" "strings" ) -var FakeOutbound_AND = consts2.OutboundLogicalAnd.String() +var FakeOutbound_AND = consts.OutboundLogicalAnd.String() type MatcherBuilder interface { AddDomain(key string, values []string, outbound string) @@ -20,8 +20,8 @@ type MatcherBuilder interface { AddPort(values [][2]int, outbound string) AddSource(values []netip.Prefix, outbound string) AddSourcePort(values [][2]int, outbound string) - AddNetwork(values consts2.NetworkType, outbound string) - AddIpVersion(values consts2.IpVersion, outbound string) + AddNetwork(values consts.NetworkType, outbound string) + AddIpVersion(values consts.IpVersion, outbound string) AddMac(values [][6]byte, outbound string) AddFinal(outbound string) AddAnyBefore(key string, values []string, outbound string) @@ -92,8 +92,8 @@ func (d *DefaultMatcherBuilder) AddIp(values []netip.Prefix, outbound string) func (d *DefaultMatcherBuilder) AddPort(values [][2]int, outbound string) {} func (d *DefaultMatcherBuilder) AddSource(values []netip.Prefix, outbound string) {} func (d *DefaultMatcherBuilder) AddSourcePort(values [][2]int, outbound string) {} -func (d *DefaultMatcherBuilder) AddNetwork(values consts2.NetworkType, outbound string) {} -func (d *DefaultMatcherBuilder) AddIpVersion(values consts2.IpVersion, outbound string) {} +func (d *DefaultMatcherBuilder) AddNetwork(values consts.NetworkType, outbound string) {} +func (d *DefaultMatcherBuilder) AddIpVersion(values consts.IpVersion, outbound string) {} func (d *DefaultMatcherBuilder) AddMac(values [][6]byte, outbound string) {} func (d *DefaultMatcherBuilder) AddFinal(outbound string) {} func (d *DefaultMatcherBuilder) AddAnyBefore(key string, values []string, outbound string) {} diff --git a/component/routing/optimizer.go b/component/routing/optimizer.go index 70f827a..78fb481 100644 --- a/component/routing/optimizer.go +++ b/component/routing/optimizer.go @@ -7,9 +7,9 @@ package routing import ( "fmt" - "foo/common/assets" - "foo/common/consts" - "foo/pkg/geodata" + "github.com/v2rayA/dae/common/assets" + "github.com/v2rayA/dae/common/consts" + "github.com/v2rayA/dae/pkg/geodata" "github.com/sirupsen/logrus" "net/netip" "sort" diff --git a/component/routing/walker.go b/component/routing/walker.go index f0e1d6d..953ef2b 100644 --- a/component/routing/walker.go +++ b/component/routing/walker.go @@ -7,7 +7,7 @@ package routing import ( "fmt" - "foo/common/consts" + "github.com/v2rayA/dae/common/consts" "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/v2rayA/RoutingA-dist/go/routingA" "strconv" diff --git a/go.mod b/go.mod index d6ee57e..f720e05 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module foo +module github.com/v2rayA/dae go 1.19 diff --git a/main.go b/main.go index 38e65c2..64abd4c 100644 --- a/main.go +++ b/main.go @@ -8,8 +8,8 @@ package main import ( - "foo/component/control" - "foo/pkg/logger" + "github.com/v2rayA/dae/component/control" + "github.com/v2rayA/dae/pkg/logger" "os" "os/signal" "syscall"