func NewModule(base mb.BaseModule) (mb.Module, error) { // Validate that at least one host has been specified. config := struct { Hosts []string `config:"hosts" validate:"nonzero,required"` }{} if err := base.UnpackConfig(&config); err != nil { return nil, err } return &base, nil }
func NewModule(base mb.BaseModule) (mb.Module, error) { // Unpack additional configuration options. config := struct { Protocol string `config:"protocol"` }{ Protocol: "udp", } if err := base.UnpackConfig(&config); err != nil { return nil, err } return &Module{BaseModule: base, Protocol: config.Protocol}, nil }