Procházet zdrojové kódy

Merge pull request #510 from 9seconds/simple-run-proxy-protocol-listener

simple-run: add --proxy-protocol-listener flag
master
Sergei Arkhipov před 4 dny
rodič
revize
85fc2c6bfd
Žádný účet není propojen s e-mailovou adresou tvůrce revize
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 3
    0
      internal/cli/simple_run.go

+ 3
- 0
internal/cli/simple_run.go Zobrazit soubor

@@ -24,6 +24,8 @@ type SimpleRun struct {
24 24
 	Timeout             time.Duration `kong:"name='timeout',short='t',default='10s',help='Network timeout to use'"`                                                    //nolint: lll
25 25
 	Socks5Proxies       []string      `kong:"name='socks5-proxy',short='s',help='Socks5 proxies to use for network access.'"`                                          //nolint: lll
26 26
 	AntiReplayCacheSize string        `kong:"name='antireplay-cache-size',short='a',default='1MB',help='A size of anti-replay cache to use.'"`                         //nolint: lll
27
+
28
+	ProxyProtocolListener bool `kong:"name='proxy-protocol-listener',help='Expect PROXY protocol (v1 or v2) headers on the listener. Use when mtg sits behind HAProxy, nginx stream, or similar.'"` //nolint: lll
27 29
 }
28 30
 
29 31
 func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funlen
@@ -97,6 +99,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
97 99
 	conf.Debug.Value = s.Debug
98 100
 	conf.AllowFallbackOnUnknownDC.Value = true
99 101
 	conf.Defense.AntiReplay.Enabled.Value = true
102
+	conf.ProxyProtocolListener.Value = s.ProxyProtocolListener
100 103
 
101 104
 	if err := conf.Validate(); err != nil {
102 105
 		return fmt.Errorf("invalid result configuration: %w", err)

Načítá se…
Zrušit
Uložit