package config import "fmt" type ProxyARP struct { // Address is the IP address to proxy ARP for. Address string `yaml:"address"` // Interface is the local interface where the proxied host resides. Interface string `yaml:"interface,omitempty"` // External is the external-facing interface. External string `yaml:"external"` // HaveRoute indicates that a route to the address already exists, // so no interface is required. HaveRoute bool `yaml:"haveroute,omitempty"` // Persistent survives firewall restarts. Persistent bool `yaml:"persistent,omitempty"` Comment string `yaml:"comment,omitempty"` } func (c *Config) validateProxyARP() error { for i, p := range c.ProxyARP { if p.Address == "" { return fmt.Errorf("proxyarp[%d]: address required", i) } if p.External == "" { return fmt.Errorf("proxyarp[%d]: external required", i) } if p.Interface == "" && !p.HaveRoute { return fmt.Errorf("proxyarp[%d]: interface required unless haveroute is set", i) } } return nil }