package yaml_model import "gopkg.in/yaml.v3" type Ipam struct { Ipam6 Ipam6 `yaml:"ipam6,omitempty"` Routers map[string]Router `yaml:"routers,omitempty"` } type Ipam6 struct { Networks map[string]Network6Yaml `yaml:"networks"` } type Network6Yaml struct { Range string `yaml:"range"` Hosts map[string]string `yaml:"hosts"` } type Router struct { As string `yaml:"as,omitempty"` Peers map[string]Peer `yaml:"peers,omitempty"` } type Peer struct { As string `yaml:"as"` } func Parse(bs []byte) (Ipam, error) { var ipam Ipam err := yaml.Unmarshal(bs, &ipam) if err != nil { return Ipam{}, err } return ipam, nil }