36 lines
909 B
Go
36 lines
909 B
Go
package cdp
|
|
|
|
import (
|
|
"src.dualinventive.com/go/lib/dilog"
|
|
)
|
|
|
|
// EndpointOption is a single option when creating a new Endpoint
|
|
type EndpointOption func(ep *Endpoint) error
|
|
|
|
// WithUplinkMsgReportHandler attaches a UplinkMsgReportHandlerFunc handler to the endpoint
|
|
func WithUplinkMsgReportHandler(h UplinkMsgReportHandlerFunc) EndpointOption {
|
|
return func(ep *Endpoint) error {
|
|
ep.uplinkMsgReportHandler = h
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithBasicAuth sets the username and password needed for T-Mobile CDP HTTP delivery
|
|
func WithBasicAuth(username, password string) EndpointOption {
|
|
return func(ep *Endpoint) error {
|
|
ep.basicAuth = &endpointBasicAuth{
|
|
Username: []byte(username),
|
|
Password: []byte(password),
|
|
}
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithDILogger attaches the log as an EndpointOption
|
|
func WithDILogger(l dilog.Logger) EndpointOption {
|
|
return func(ep *Endpoint) error {
|
|
ep.log = l
|
|
return nil
|
|
}
|
|
}
|