-
Notifications
You must be signed in to change notification settings - Fork 1
/
option.go
36 lines (30 loc) · 850 Bytes
/
option.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package listen
import (
"github.com/borderzero/border0-go/client"
)
// Option is a function that configures a Listener.
type Option func(*Listener)
// WithAPIClient sets the API client to use for the Listener.
func WithAPIClient(api client.Requester) Option {
return func(l *Listener) {
l.apiClient = api
}
}
// WithAuthToken sets the auth token to use with the API client.
func WithAuthToken(token string) Option {
return func(l *Listener) {
l.authToken = token
}
}
// WithSocketName sets the socket name to use for the HTTP socket that the Listener will create.
func WithSocketName(name string) Option {
return func(l *Listener) {
l.socketName = name
}
}
// WithTunnelServer sets the tunnel server address for the Listener.
func WithTunnelServer(server string) Option {
return func(l *Listener) {
l.tunnelServer = server
}
}