2
0
mirror of https://github.com/edouardparis/lntop synced 2024-11-13 13:10:34 +00:00
lntop/network/options/channels.go
2019-03-15 17:02:16 +01:00

35 lines
673 B
Go

package options
type Channel func(*ChannelOptions)
type ChannelOptions struct {
Active bool
Inactive bool
Public bool
Private bool
}
func WithChannelPublic(v bool) Channel {
return func(c *ChannelOptions) { c.Public = v }
}
func WithChannelPrivate(v bool) Channel {
return func(c *ChannelOptions) { c.Private = v }
}
func WithChannelActive(v bool) Channel {
return func(c *ChannelOptions) { c.Active = v }
}
func WithChannelInactive(v bool) Channel {
return func(c *ChannelOptions) { c.Inactive = v }
}
func NewChannelOptions(options ...Channel) ChannelOptions {
opts := ChannelOptions{}
for i := range options {
options[i](&opts)
}
return opts
}