Allow cidr based reverse zone config (#500)
* add cidrs opt * remove state data from middleware object
This commit is contained in:
parent
3a04d2a306
commit
8beb1b2166
3 changed files with 33 additions and 1 deletions
|
@ -3,6 +3,7 @@ package kubernetes
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -84,6 +85,20 @@ func kubernetesParse(c *caddy.Controller) (*Kubernetes, error) {
|
|||
|
||||
for c.NextBlock() {
|
||||
switch c.Val() {
|
||||
case "cidrs":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) > 0 {
|
||||
for _, cidrStr := range args {
|
||||
_, cidr, err := net.ParseCIDR(cidrStr)
|
||||
if err != nil {
|
||||
return nil, errors.New(c.Val() + " contains an invalid cidr: " + cidrStr)
|
||||
}
|
||||
k8s.ReverseCidrs = append(k8s.ReverseCidrs, *cidr)
|
||||
|
||||
}
|
||||
continue
|
||||
}
|
||||
return nil, c.ArgErr()
|
||||
case "pods":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) == 1 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue