Skip to content

Commit 8f23733

Browse files
authored
Merge pull request #4137 from fatedier/dev
bump version
2 parents 5a6d9f6 + d2d03a8 commit 8f23733

File tree

15 files changed

+311
-186
lines changed

15 files changed

+311
-186
lines changed

Release.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
### Features
22

3-
* Support range ports mapping in TOML/YAML/JSON configuration file by using go template syntax.
4-
5-
For example:
6-
7-
```
8-
{{- range $_, $v := parseNumberRangePair "6000-6006,6007" "6000-6006,6007" }}
9-
[[proxies]]
10-
name = "tcp-{{ $v.First }}"
11-
type = "tcp"
12-
localPort = {{ $v.First }}
13-
remotePort = {{ $v.Second }}
14-
{{- end }}
15-
```
16-
17-
This will create 8 proxies such as `tcp-6000, tcp-6001, ... tcp-6007`.
18-
19-
* Health check supports custom request headers.
20-
* Enable compatibility mode for the Android system to solve the issues of incorrect log time caused by time zone problems and default DNS resolution failures.
3+
* `https2http` and `https2https` plugin now supports `X-Forwared-For` header.
214

225
### Fixes
236

24-
* Fix the issue of incorrect interval time for rotating the log by day.
25-
* Disable quic-go's ECN support by default. It may cause issues on certain operating systems.
7+
* `X-Forwared-For` header is now correctly set in the request to the backend server for proxy type http.

client/proxy/proxy.go

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -158,33 +158,35 @@ func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWor
158158

159159
// check if we need to send proxy protocol info
160160
var extraInfo plugin.ExtraInfo
161-
if baseCfg.Transport.ProxyProtocolVersion != "" {
162-
if m.SrcAddr != "" && m.SrcPort != 0 {
163-
if m.DstAddr == "" {
164-
m.DstAddr = "127.0.0.1"
165-
}
166-
srcAddr, _ := net.ResolveTCPAddr("tcp", net.JoinHostPort(m.SrcAddr, strconv.Itoa(int(m.SrcPort))))
167-
dstAddr, _ := net.ResolveTCPAddr("tcp", net.JoinHostPort(m.DstAddr, strconv.Itoa(int(m.DstPort))))
168-
h := &pp.Header{
169-
Command: pp.PROXY,
170-
SourceAddr: srcAddr,
171-
DestinationAddr: dstAddr,
172-
}
173-
174-
if strings.Contains(m.SrcAddr, ".") {
175-
h.TransportProtocol = pp.TCPv4
176-
} else {
177-
h.TransportProtocol = pp.TCPv6
178-
}
179-
180-
if baseCfg.Transport.ProxyProtocolVersion == "v1" {
181-
h.Version = 1
182-
} else if baseCfg.Transport.ProxyProtocolVersion == "v2" {
183-
h.Version = 2
184-
}
185-
186-
extraInfo.ProxyProtocolHeader = h
161+
if m.SrcAddr != "" && m.SrcPort != 0 {
162+
if m.DstAddr == "" {
163+
m.DstAddr = "127.0.0.1"
187164
}
165+
srcAddr, _ := net.ResolveTCPAddr("tcp", net.JoinHostPort(m.SrcAddr, strconv.Itoa(int(m.SrcPort))))
166+
dstAddr, _ := net.ResolveTCPAddr("tcp", net.JoinHostPort(m.DstAddr, strconv.Itoa(int(m.DstPort))))
167+
extraInfo.SrcAddr = srcAddr
168+
extraInfo.DstAddr = dstAddr
169+
}
170+
171+
if baseCfg.Transport.ProxyProtocolVersion != "" && m.SrcAddr != "" && m.SrcPort != 0 {
172+
h := &pp.Header{
173+
Command: pp.PROXY,
174+
SourceAddr: extraInfo.SrcAddr,
175+
DestinationAddr: extraInfo.DstAddr,
176+
}
177+
178+
if strings.Contains(m.SrcAddr, ".") {
179+
h.TransportProtocol = pp.TCPv4
180+
} else {
181+
h.TransportProtocol = pp.TCPv6
182+
}
183+
184+
if baseCfg.Transport.ProxyProtocolVersion == "v1" {
185+
h.Version = 1
186+
} else if baseCfg.Transport.ProxyProtocolVersion == "v2" {
187+
h.Version = 2
188+
}
189+
extraInfo.ProxyProtocolHeader = h
188190
}
189191

190192
if pxy.proxyPlugin != nil {

go.mod

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,79 +4,78 @@ go 1.22
44

55
require (
66
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
7-
github.com/coreos/go-oidc/v3 v3.6.0
7+
github.com/coreos/go-oidc/v3 v3.10.0
88
github.com/fatedier/golib v0.4.2
9-
github.com/google/uuid v1.3.0
10-
github.com/gorilla/mux v1.8.0
11-
github.com/gorilla/websocket v1.5.0
9+
github.com/google/uuid v1.6.0
10+
github.com/gorilla/mux v1.8.1
11+
github.com/gorilla/websocket v1.5.1
1212
github.com/hashicorp/yamux v0.1.1
13-
github.com/onsi/ginkgo/v2 v2.11.0
14-
github.com/onsi/gomega v1.27.8
15-
github.com/pelletier/go-toml/v2 v2.1.0
13+
github.com/onsi/ginkgo/v2 v2.17.1
14+
github.com/onsi/gomega v1.32.0
15+
github.com/pelletier/go-toml/v2 v2.2.0
1616
github.com/pion/stun/v2 v2.0.0
1717
github.com/pires/go-proxyproto v0.7.0
18-
github.com/prometheus/client_golang v1.16.0
19-
github.com/quic-go/quic-go v0.41.0
20-
github.com/rodaine/table v1.1.0
18+
github.com/prometheus/client_golang v1.19.0
19+
github.com/quic-go/quic-go v0.42.0
20+
github.com/rodaine/table v1.2.0
2121
github.com/samber/lo v1.39.0
2222
github.com/spf13/cobra v1.8.0
2323
github.com/spf13/pflag v1.0.5
24-
github.com/stretchr/testify v1.8.4
24+
github.com/stretchr/testify v1.9.0
2525
github.com/tidwall/gjson v1.17.1
26-
github.com/xtaci/kcp-go/v5 v5.6.7
27-
golang.org/x/crypto v0.18.0
28-
golang.org/x/net v0.19.0
29-
golang.org/x/oauth2 v0.10.0
30-
golang.org/x/sync v0.3.0
31-
golang.org/x/time v0.3.0
26+
github.com/xtaci/kcp-go/v5 v5.6.8
27+
golang.org/x/crypto v0.22.0
28+
golang.org/x/net v0.24.0
29+
golang.org/x/oauth2 v0.16.0
30+
golang.org/x/sync v0.6.0
31+
golang.org/x/time v0.5.0
3232
gopkg.in/ini.v1 v1.67.0
33-
k8s.io/apimachinery v0.27.4
34-
k8s.io/client-go v0.27.4
33+
k8s.io/apimachinery v0.28.8
34+
k8s.io/client-go v0.28.8
3535
)
3636

3737
require (
3838
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
3939
github.com/beorn7/perks v1.0.1 // indirect
4040
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4141
github.com/davecgh/go-spew v1.1.1 // indirect
42-
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
43-
github.com/go-logr/logr v1.2.4 // indirect
42+
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
43+
github.com/go-logr/logr v1.4.1 // indirect
4444
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
45-
github.com/golang/protobuf v1.5.3 // indirect
45+
github.com/golang/protobuf v1.5.4 // indirect
4646
github.com/golang/snappy v0.0.4 // indirect
47-
github.com/google/go-cmp v0.5.9 // indirect
47+
github.com/google/go-cmp v0.6.0 // indirect
4848
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
4949
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5050
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
5151
github.com/klauspost/reedsolomon v1.12.0 // indirect
5252
github.com/kr/text v0.2.0 // indirect
53-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
5453
github.com/pion/dtls/v2 v2.2.7 // indirect
5554
github.com/pion/logging v0.2.2 // indirect
5655
github.com/pion/transport/v2 v2.2.1 // indirect
5756
github.com/pion/transport/v3 v3.0.1 // indirect
5857
github.com/pkg/errors v0.9.1 // indirect
5958
github.com/pmezard/go-difflib v1.0.0 // indirect
60-
github.com/prometheus/client_model v0.3.0 // indirect
61-
github.com/prometheus/common v0.42.0 // indirect
62-
github.com/prometheus/procfs v0.10.1 // indirect
59+
github.com/prometheus/client_model v0.5.0 // indirect
60+
github.com/prometheus/common v0.48.0 // indirect
61+
github.com/prometheus/procfs v0.12.0 // indirect
6362
github.com/rogpeppe/go-internal v1.11.0 // indirect
6463
github.com/templexxx/cpu v0.1.0 // indirect
6564
github.com/templexxx/xorsimd v0.4.2 // indirect
6665
github.com/tidwall/match v1.1.1 // indirect
6766
github.com/tidwall/pretty v1.2.0 // indirect
6867
github.com/tjfoc/gmsm v1.4.1 // indirect
69-
go.uber.org/mock v0.3.0 // indirect
68+
go.uber.org/mock v0.4.0 // indirect
7069
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
71-
golang.org/x/mod v0.11.0 // indirect
72-
golang.org/x/sys v0.16.0 // indirect
70+
golang.org/x/mod v0.14.0 // indirect
71+
golang.org/x/sys v0.19.0 // indirect
7372
golang.org/x/text v0.14.0 // indirect
74-
golang.org/x/tools v0.9.3 // indirect
75-
google.golang.org/appengine v1.6.7 // indirect
76-
google.golang.org/protobuf v1.31.0 // indirect
73+
golang.org/x/tools v0.17.0 // indirect
74+
google.golang.org/appengine v1.6.8 // indirect
75+
google.golang.org/protobuf v1.33.0 // indirect
7776
gopkg.in/yaml.v2 v2.4.0 // indirect
7877
gopkg.in/yaml.v3 v3.0.1 // indirect
79-
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
78+
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
8079
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
8180
sigs.k8s.io/yaml v1.3.0 // indirect
8281
)

0 commit comments

Comments
 (0)