feat(modem): method to configure APN/authentication
This commit is contained in:
41
reach/client/protocol/modem.go
Normal file
41
reach/client/protocol/modem.go
Normal file
@ -0,0 +1,41 @@
|
||||
package protocol
|
||||
|
||||
type SetModemOptions struct {
|
||||
Apn *string
|
||||
Type *string
|
||||
Username *string
|
||||
Password *string
|
||||
}
|
||||
|
||||
type SetModemOptionsFunc func(opts *SetModemOptions)
|
||||
|
||||
func NewSetModemOptions(funcs ...SetModemOptionsFunc) *SetModemOptions {
|
||||
opts := &SetModemOptions{}
|
||||
for _, fn := range funcs {
|
||||
fn(opts)
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
func WithApn(value string) SetModemOptionsFunc {
|
||||
return func(opts *SetModemOptions) {
|
||||
opts.Apn = &value
|
||||
}
|
||||
}
|
||||
|
||||
func WithType(value string) SetModemOptionsFunc {
|
||||
return func(opts *SetModemOptions) {
|
||||
opts.Type = &value
|
||||
}
|
||||
}
|
||||
|
||||
func WithUsername(value string) SetModemOptionsFunc {
|
||||
return func(opts *SetModemOptions) {
|
||||
opts.Username = &value
|
||||
}
|
||||
}
|
||||
func WithPassword(value string) SetModemOptionsFunc {
|
||||
return func(opts *SetModemOptions) {
|
||||
opts.Password = &value
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user