Skip to content

Commit 8daeaeb

Browse files
committed
Revert "Revert "Pull fedclient interface over from dendrite (#366)" (#370)"
This reverts commit 3724c73.
1 parent 070fb67 commit 8daeaeb

File tree

3 files changed

+158
-95
lines changed

3 files changed

+158
-95
lines changed

fclient/client.go

+9
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type clientOptions struct {
6060
skipVerify bool
6161
keepAlives bool
6262
wellKnownSRV bool
63+
userAgent string
6364
}
6465

6566
// ClientOption are supplied to NewClient or NewFederationClient.
@@ -88,6 +89,7 @@ func NewClient(options ...ClientOption) *Client {
8889
Transport: clientOpts.transport,
8990
Timeout: clientOpts.timeout,
9091
},
92+
userAgent: clientOpts.userAgent,
9193
}
9294
return client
9395
}
@@ -143,6 +145,13 @@ func WithWellKnownSRVLookups(wellKnownSRV bool) ClientOption {
143145
}
144146
}
145147

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+
146155
const destinationTripperLifetime = time.Minute * 5 // how long to keep an entry
147156
const destinationTripperReapInterval = time.Minute // how often to check for dead entries
148157

0 commit comments

Comments
 (0)