-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_opts.go
70 lines (57 loc) · 1.08 KB
/
client_opts.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package hdsclient
import (
"crypto/ecdsa"
"net/http"
httpcmn "github.com/aukilabs/hagall-common/http"
)
type ClientOpts func(*Client)
func WithHagallEndpoint(v string) ClientOpts {
return func(c *Client) {
c.HagallEndpoint = v
}
}
func WithHDSEndpoint(v string) ClientOpts {
return func(c *Client) {
c.HDSEndpoint = httpcmn.NormalizeEndpoint(v)
}
}
func WithEncoder(v Encoder) ClientOpts {
return func(c *Client) {
c.Encode = v
}
}
func WithDecoder(v Decoder) ClientOpts {
return func(c *Client) {
c.Decode = v
}
}
func WithTransport(v http.RoundTripper) ClientOpts {
return func(c *Client) {
c.Transport = v
}
}
func WithSecret(v string) ClientOpts {
return func(c *Client) {
c.secret = v
}
}
func WithRemoteAddr(v string) ClientOpts {
return func(c *Client) {
c.RemoteAddr = v
}
}
func WithServerID(v string) ClientOpts {
return func(c *Client) {
c.serverID = v
}
}
func WithClientID(v string) ClientOpts {
return func(c *Client) {
c.clientID = v
}
}
func WithPrivateKey(v *ecdsa.PrivateKey) ClientOpts {
return func(c *Client) {
c.privateKey = v
}
}