-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
60 lines (51 loc) · 1.86 KB
/
config.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
package modulego
type Option func(*Client)
// WithEndpoint is a functional option to set the endpoint of the Protection API.
func WithEndpoint(endpoint string) Option {
return func(c *Client) {
c.Endpoint = endpoint
}
}
// WithGraphQLSupport is a functional option to enable the GraphQL support.
func WithGraphQLSupport(enableGraphQLSupport bool) Option {
return func(c *Client) {
c.EnableGraphQLSupport = enableGraphQLSupport
}
}
// WithLogger is a functional option to set a custom Logger for the Client.
func WithLogger(logger Logger) Option {
return func(c *Client) {
c.Logger = logger
}
}
// WithMaximumBodySize is a functional option to set the maximum size of a body to be analyzed.
// This option may be set when the GraphQL Support is enabled.
func WithMaximumBodySize(maximumBodySize int) Option {
return func(c *Client) {
c.MaximumBodySize = maximumBodySize
}
}
// WithReferrerRestoration is a functional option to enable the referrer restoration feature.
func WithReferrerRestoration(enableReferrerRestoration bool) Option {
return func(c *Client) {
c.EnableReferrerRestoration = enableReferrerRestoration
}
}
// WithTimeout is a functional option to set the HTTP Client timeout in milliseconds.
func WithTimeout(timeout int) Option {
return func(c *Client) {
c.Timeout = timeout
}
}
// WithUrlPatternExclusion is a functional option to define the regular expression to exclude the request from being processed with the Protection API.
func WithUrlPatternExclusion(urlPatternExclusion string) Option {
return func(c *Client) {
c.UrlPatternExclusion = urlPatternExclusion
}
}
// WithUrlPatternInclusion is a functional option to define the regular expression to match to process the request with the Protection API.
func WithUrlPatternInclusion(urlPatternInclusion string) Option {
return func(c *Client) {
c.UrlPatternInclusion = urlPatternInclusion
}
}