*: reflect SPEC's DNS changes in implementation
* DNS is now a type which will result in a JSON dictionary in configurations and results * Minor refactoring, making use of type embedding
This commit is contained in:
parent
abb6ee1dd1
commit
137dc8a673
@ -61,13 +61,14 @@ type NetConf struct {
|
|||||||
IPAM struct {
|
IPAM struct {
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
} `json:"ipam,omitempty"`
|
} `json:"ipam,omitempty"`
|
||||||
|
DNS DNS `json:"dns"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result is what gets returned from the plugin (via stdout) to the caller
|
// Result is what gets returned from the plugin (via stdout) to the caller
|
||||||
type Result struct {
|
type Result struct {
|
||||||
IP4 *IPConfig `json:"ip4,omitempty"`
|
IP4 *IPConfig `json:"ip4,omitempty"`
|
||||||
IP6 *IPConfig `json:"ip6,omitempty"`
|
IP6 *IPConfig `json:"ip6,omitempty"`
|
||||||
DNS []string `json:"dns,omitempty"`
|
DNS DNS `json:"dns,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Result) Print() error {
|
func (r *Result) Print() error {
|
||||||
@ -81,6 +82,14 @@ type IPConfig struct {
|
|||||||
Routes []Route
|
Routes []Route
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DNS contains values interesting for DNS resolvers
|
||||||
|
type DNS struct {
|
||||||
|
Nameservers []string `json:"nameservers,omitempty"`
|
||||||
|
Domain string `json:"domain,omitempty"`
|
||||||
|
Search []string `json:"search,omitempty"`
|
||||||
|
Options []string `json:"options,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type Route struct {
|
type Route struct {
|
||||||
Dst net.IPNet
|
Dst net.IPNet
|
||||||
GW net.IP
|
GW net.IP
|
||||||
|
@ -39,7 +39,6 @@ type NetConf struct {
|
|||||||
IsGW bool `json:"isGateway"`
|
IsGW bool `json:"isGateway"`
|
||||||
IPMasq bool `json:"ipMasq"`
|
IPMasq bool `json:"ipMasq"`
|
||||||
MTU int `json:"mtu"`
|
MTU int `json:"mtu"`
|
||||||
DNS []string `json:"dns"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -34,7 +34,6 @@ type NetConf struct {
|
|||||||
Master string `json:"master"`
|
Master string `json:"master"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
MTU int `json:"mtu"`
|
MTU int `json:"mtu"`
|
||||||
DNS []string `json:"dns"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -34,7 +34,6 @@ type NetConf struct {
|
|||||||
Master string `json:"master"`
|
Master string `json:"master"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
MTU int `json:"mtu"`
|
MTU int `json:"mtu"`
|
||||||
DNS []string `json:"dns"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -43,7 +43,6 @@ type NetConf struct {
|
|||||||
types.NetConf
|
types.NetConf
|
||||||
IPMasq bool `json:"ipMasq"`
|
IPMasq bool `json:"ipMasq"`
|
||||||
MTU int `json:"mtu"`
|
MTU int `json:"mtu"`
|
||||||
DNS []string `json:"dns"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string, error) {
|
func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user