From a08b015fa52d7ee1672e076f286414a3f1f42036 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Wed, 27 Jan 2016 12:12:16 +0100 Subject: [PATCH] *: 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 --- types/types.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/types.go b/types/types.go index e5558be..6ae4a64 100644 --- a/types/types.go +++ b/types/types.go @@ -61,13 +61,14 @@ type NetConf struct { IPAM struct { Type string `json:"type,omitempty"` } `json:"ipam,omitempty"` + DNS DNS `json:"dns"` } // Result is what gets returned from the plugin (via stdout) to the caller type Result struct { IP4 *IPConfig `json:"ip4,omitempty"` IP6 *IPConfig `json:"ip6,omitempty"` - DNS []string `json:"dns,omitempty"` + DNS DNS `json:"dns,omitempty"` } func (r *Result) Print() error { @@ -81,6 +82,14 @@ type IPConfig struct { 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 { Dst net.IPNet GW net.IP -- 2.44.0