Skip to content

Commit

Permalink
don't allow by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercactapus committed Feb 14, 2017
1 parent 3939c24 commit 1ba779f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -17,7 +17,7 @@ The default timeout is `5s`. Set to `0` or `none` to disable the timeout.

```
# Enable from any source (probably don't want this in prod)
proxyprotocol
proxyprotocol 0.0.0.0/0 ::/0
# Enable from local subnet and fixed IP
proxyprotocol 10.22.0.0/16 10.23.0.1/32
Expand Down
3 changes: 0 additions & 3 deletions listeners.go
Expand Up @@ -44,9 +44,6 @@ func (l *Listener) Accept() (net.Conn, error) {
return c, nil
}
for _, cfg := range l.Configs {
if cfg.Subnets == nil {
return proxyproto.NewConn(c, cfg.Timeout), nil
}
for _, s := range cfg.Subnets {
if s.Contains(addr.IP) {
return proxyproto.NewConn(c, cfg.Timeout), nil
Expand Down
3 changes: 3 additions & 0 deletions setup.go
Expand Up @@ -48,6 +48,9 @@ func setup(c *caddy.Controller) error {
return c.ArgErr()
}
}
if cfg.Subnets == nil {
continue
}
configs = append(configs, cfg)
if c.NextBlock() {
return c.ArgErr()
Expand Down

0 comments on commit 1ba779f

Please sign in to comment.