Skip to content

Commit

Permalink
Make RoundTripperOption public so users can allocate a slice of options
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Aug 21, 2023
1 parent d88fa5e commit 10f83fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions p2p/http/libp2phttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func (h *HTTPHost) NamespaceRoundTripper(roundtripper http.RoundTripper, p proto
// creating many namespaced clients, consider creating a round tripper directly
// and namespacing the roundripper yourself, then creating clients from the
// namespace round tripper.
func (h *HTTPHost) NamespacedClient(p protocol.ID, server peer.AddrInfo, opts ...roundTripperOptsFn) (http.Client, error) {
func (h *HTTPHost) NamespacedClient(p protocol.ID, server peer.AddrInfo, opts ...RoundTripperOption) (http.Client, error) {
rt, err := h.NewRoundTripper(server, opts...)
if err != nil {
return http.Client{}, err
Expand All @@ -531,7 +531,7 @@ func (h *HTTPHost) NamespacedClient(p protocol.ID, server peer.AddrInfo, opts ..
// NewRoundTripper returns an http.RoundTripper that can fulfill and HTTP
// request to the given server. It may use an HTTP transport or a stream based
// transport. It is valid to pass an empty server.ID.
func (h *HTTPHost) NewRoundTripper(server peer.AddrInfo, opts ...roundTripperOptsFn) (http.RoundTripper, error) {
func (h *HTTPHost) NewRoundTripper(server peer.AddrInfo, opts ...RoundTripperOption) (http.RoundTripper, error) {
options := roundTripperOpts{}
for _, o := range opts {
options = o(options)
Expand Down
2 changes: 1 addition & 1 deletion p2p/http/options.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package libp2phttp

type roundTripperOptsFn func(o roundTripperOpts) roundTripperOpts
type RoundTripperOption func(o roundTripperOpts) roundTripperOpts

type roundTripperOpts struct {
// todo SkipClientAuth bool
Expand Down

0 comments on commit 10f83fd

Please sign in to comment.