Source File
option.go
Belonging Package
github.com/koron/go-ssdp
package ssdpimporttype config struct {multicastConfigadvertiseConfig}func opts2config( []Option) ( config, error) {for , := range {:= .apply(&)if != nil {return config{},}}return , nil}type multicastConfig struct {ttl intsysIf bool}func ( multicastConfig) () ( []multicast.ConnOption) {if .ttl > 0 {= append(, multicast.ConnTTL(.ttl))}if .sysIf {= append(, multicast.ConnSystemAssginedInterface())}return}type advertiseConfig struct {addHost bool}// Option is option set for SSDP API.type Option interface {apply(c *config) error}type optionFunc func(*config) errorfunc ( optionFunc) ( *config) error {return ()}// TTL returns as Option that set TTL for multicast packets.func ( int) Option {return optionFunc(func( *config) error {.ttl =return nil})}// OnlySystemInterface returns as Option that using only a system assigned// multicast interface.func () Option {return optionFunc(func( *config) error {.sysIf = truereturn nil})}// AdvertiseHost returns as Option that add HOST header to response for// M-SEARCH requests.// This option works with Advertise() function only.// This is added to support SmartThings.// See https://github.com/koron/go-ssdp/issues/30 for details.func () Option {return optionFunc(func( *config) error {.addHost = truereturn nil})}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |