From f9cc1cc3630015687a3a3fa5a6d07d1d7700bbc3 Mon Sep 17 00:00:00 2001 From: risetechlab <79727391+risetechlab@users.noreply.github.com> Date: Sat, 19 Mar 2022 13:29:30 +0800 Subject: [PATCH 1/4] Fix: routing-mark option doesn't work on proxies (#2028) --- adapter/outbound/http.go | 1 + adapter/outbound/shadowsocks.go | 1 + adapter/outbound/shadowsocksr.go | 1 + adapter/outbound/snell.go | 1 + adapter/outbound/socks5.go | 1 + adapter/outbound/trojan.go | 1 + adapter/outbound/vmess.go | 1 + 7 files changed, 7 insertions(+) diff --git a/adapter/outbound/http.go b/adapter/outbound/http.go index 7f480ce6..44dc705a 100644 --- a/adapter/outbound/http.go +++ b/adapter/outbound/http.go @@ -136,6 +136,7 @@ func NewHttp(option HttpOption) *Http { addr: net.JoinHostPort(option.Server, strconv.Itoa(option.Port)), tp: C.Http, iface: option.Interface, + rmark: option.RoutingMark, }, user: option.UserName, pass: option.Password, diff --git a/adapter/outbound/shadowsocks.go b/adapter/outbound/shadowsocks.go index 71b4ae5e..d80c7962 100644 --- a/adapter/outbound/shadowsocks.go +++ b/adapter/outbound/shadowsocks.go @@ -160,6 +160,7 @@ func NewShadowSocks(option ShadowSocksOption) (*ShadowSocks, error) { tp: C.Shadowsocks, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, cipher: ciph, diff --git a/adapter/outbound/shadowsocksr.go b/adapter/outbound/shadowsocksr.go index d244df40..a5f07ef6 100644 --- a/adapter/outbound/shadowsocksr.go +++ b/adapter/outbound/shadowsocksr.go @@ -142,6 +142,7 @@ func NewShadowSocksR(option ShadowSocksROption) (*ShadowSocksR, error) { tp: C.ShadowsocksR, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, cipher: coreCiph, obfs: obfs, diff --git a/adapter/outbound/snell.go b/adapter/outbound/snell.go index d90922ea..07f3d89d 100644 --- a/adapter/outbound/snell.go +++ b/adapter/outbound/snell.go @@ -142,6 +142,7 @@ func NewSnell(option SnellOption) (*Snell, error) { tp: C.Snell, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, psk: psk, obfsOption: obfsOption, diff --git a/adapter/outbound/socks5.go b/adapter/outbound/socks5.go index d81c7614..398ee3b2 100644 --- a/adapter/outbound/socks5.go +++ b/adapter/outbound/socks5.go @@ -154,6 +154,7 @@ func NewSocks5(option Socks5Option) *Socks5 { tp: C.Socks5, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, user: option.UserName, pass: option.Password, diff --git a/adapter/outbound/trojan.go b/adapter/outbound/trojan.go index 35dbea1e..064cd3c2 100644 --- a/adapter/outbound/trojan.go +++ b/adapter/outbound/trojan.go @@ -173,6 +173,7 @@ func NewTrojan(option TrojanOption) (*Trojan, error) { tp: C.Trojan, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, instance: trojan.New(tOption), option: &option, diff --git a/adapter/outbound/vmess.go b/adapter/outbound/vmess.go index 313aa5d6..ea3681a3 100644 --- a/adapter/outbound/vmess.go +++ b/adapter/outbound/vmess.go @@ -280,6 +280,7 @@ func NewVmess(option VmessOption) (*Vmess, error) { tp: C.Vmess, udp: option.UDP, iface: option.Interface, + rmark: option.RoutingMark, }, client: client, option: &option, From 02333a859a57ddb528eb469f734ebc2669911ee9 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Sat, 19 Mar 2022 13:42:06 +0800 Subject: [PATCH 2/4] Chore: split amd64 v3 to special release --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index c386c0cd..acc1fc33 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,11 @@ GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/Dreamacro/clas PLATFORM_LIST = \ darwin-amd64 \ + darwin-amd64-v3 \ darwin-arm64 \ linux-386 \ linux-amd64 \ + linux-amd64-v3 \ linux-armv5 \ linux-armv6 \ linux-armv7 \ @@ -23,11 +25,13 @@ PLATFORM_LIST = \ linux-mips64le \ freebsd-386 \ freebsd-amd64 \ + freebsd-amd64-v3 \ freebsd-arm64 WINDOWS_ARCH_LIST = \ windows-386 \ windows-amd64 \ + windows-amd64-v3 \ windows-arm64 \ windows-arm32v7 @@ -37,6 +41,9 @@ docker: GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ darwin-amd64: + GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ + +darwin-amd64-v3: GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ darwin-arm64: @@ -46,6 +53,9 @@ linux-386: GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ linux-amd64: + GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ + +linux-amd64-v3: GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ linux-armv5: @@ -82,6 +92,9 @@ freebsd-386: GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ freebsd-amd64: + GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ + +freebsd-amd64-v3: GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ freebsd-arm64: @@ -91,6 +104,9 @@ windows-386: GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe windows-amd64: + GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe + +windows-amd64-v3: GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe windows-arm64: From 30d4668008b493b65e7d6982b4c43bb34871e13c Mon Sep 17 00:00:00 2001 From: Kr328 Date: Sat, 19 Mar 2022 13:58:51 +0800 Subject: [PATCH 3/4] Chore: fix typo (#2033) --- component/process/process_linux.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/component/process/process_linux.go b/component/process/process_linux.go index d70a2922..1dfd0eda 100644 --- a/component/process/process_linux.go +++ b/component/process/process_linux.go @@ -103,12 +103,12 @@ func resolveSocketByNetlink(network string, ip net.IP, srcPort int) (int32, int3 return 0, 0, fmt.Errorf("netlink message: NLMSG_ERROR") } - uid, inode := unpackSocketDiagResponse(&messages[0]) - if uid < 0 || inode < 0 { - return 0, 0, fmt.Errorf("invalid uid(%d) or inode(%d)", uid, inode) + inode, uid := unpackSocketDiagResponse(&messages[0]) + if inode < 0 || uid < 0 { + return 0, 0, fmt.Errorf("invalid inode(%d) or uid(%d)", inode, uid) } - return uid, inode, nil + return inode, uid, nil } func packSocketDiagRequest(family, protocol byte, source net.IP, sourcePort uint16) []byte { From 8c9e0b38843747311cb60c4ce7ecd063edcfa963 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Sun, 20 Mar 2022 11:32:18 +0800 Subject: [PATCH 4/4] Chore: use GOAMD64 v1 on build docker image --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index acc1fc33..aed9ca4b 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ WINDOWS_ARCH_LIST = \ all: linux-amd64 darwin-amd64 windows-amd64 # Most used docker: - GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ + $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ darwin-amd64: GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@