File tree 3 files changed +158
-95
lines changed
3 files changed +158
-95
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ type clientOptions struct {
60
60
skipVerify bool
61
61
keepAlives bool
62
62
wellKnownSRV bool
63
+ userAgent string
63
64
}
64
65
65
66
// ClientOption are supplied to NewClient or NewFederationClient.
@@ -88,6 +89,7 @@ func NewClient(options ...ClientOption) *Client {
88
89
Transport : clientOpts .transport ,
89
90
Timeout : clientOpts .timeout ,
90
91
},
92
+ userAgent : clientOpts .userAgent ,
91
93
}
92
94
return client
93
95
}
@@ -143,6 +145,13 @@ func WithWellKnownSRVLookups(wellKnownSRV bool) ClientOption {
143
145
}
144
146
}
145
147
148
+ // WithUserAgent enables specifying the user agent for the http client.
149
+ func WithUserAgent (userAgent string ) ClientOption {
150
+ return func (options * clientOptions ) {
151
+ options .userAgent = userAgent
152
+ }
153
+ }
154
+
146
155
const destinationTripperLifetime = time .Minute * 5 // how long to keep an entry
147
156
const destinationTripperReapInterval = time .Minute // how often to check for dead entries
148
157
You can’t perform that action at this time.
0 commit comments