-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
44 lines (33 loc) · 920 Bytes
/
options.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
package epp
import (
"context"
"crypto/tls"
"time"
"github.com/domainr/epp2/internal/config"
"github.com/domainr/epp2/schema"
)
// Options configure [TODO] with specific features.
type Options = config.Options
// ContextDialer is any type with a DialContext method that returns ([net.Conn], [error]).
type ContextDialer = config.ContextDialer
func WithDialer(d ContextDialer) Options {
return config.Dialer{ContextDialer: d}
}
func WithTLS(cfg *tls.Config) Options {
return (*config.TLSConfig)(cfg.Clone())
}
func WithPipeline(depth int) Options {
return config.Pipeline(depth)
}
func WithContext(ctx context.Context) Options {
return config.Context{Context: ctx}
}
func WithKeepAlive(d time.Duration) Options {
return config.KeepAlive(d)
}
func WithTimeout(d time.Duration) Options {
return config.Timeout(d)
}
func WithSchema(schemas ...schema.Schema) Options {
return config.Schemas(schemas)
}