Skip to content

Commit

Permalink
config: prettify network_groups output in logs - now networks are s…
Browse files Browse the repository at this point in the history
…hown as `1.2.3.4/24` instead of `-ip: 1.2.4.5 -mask: 255 255 255 0`
  • Loading branch information
valyala committed Nov 7, 2017
1 parent 72b4592 commit 63b4c6e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ func (bs *ByteSize) UnmarshalYAML(unmarshal func(interface{}) error) error {
// Networks is a list of IPNet entities
type Networks []*net.IPNet

func (n Networks) MarshalYAML() (interface{}, error) {
var a []string
for _, x := range n {
a = append(a, x.String())
}
return a, nil
}

// UnmarshalYAML implements the yaml.Unmarshaler interface.
func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s []string
Expand Down

0 comments on commit 63b4c6e

Please sign in to comment.