Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0146e318
Commit
0146e318
authored
Apr 11, 2015
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow client.Config to wrap the underyling Transport
parent
66e746ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
helper.go
pkg/client/helper.go
+10
-1
No files found.
pkg/client/helper.go
View file @
0146e318
...
@@ -75,8 +75,14 @@ type Config struct {
...
@@ -75,8 +75,14 @@ type Config struct {
UserAgent
string
UserAgent
string
// Transport may be used for custom HTTP behavior. This attribute may not
// Transport may be used for custom HTTP behavior. This attribute may not
// be specified with the TLS client certificate options.
// be specified with the TLS client certificate options. Use WrapTransport
// for most client level operations.
Transport
http
.
RoundTripper
Transport
http
.
RoundTripper
// WrapTransport will be invoked for custom HTTP behavior after the underlying
// transport is initialized (either the transport created from TLSClientConfig,
// Transport, or http.DefaultTransport). The config may layer other RoundTrippers
// on top of the returned RoundTripper.
WrapTransport
func
(
rt
http
.
RoundTripper
)
http
.
RoundTripper
// QPS indicates the maximum QPS to the master from this client. If zero, QPS is unlimited.
// QPS indicates the maximum QPS to the master from this client. If zero, QPS is unlimited.
QPS
float32
QPS
float32
...
@@ -255,6 +261,9 @@ func TransportFor(config *Config) (http.RoundTripper, error) {
...
@@ -255,6 +261,9 @@ func TransportFor(config *Config) (http.RoundTripper, error) {
transport
=
http
.
DefaultTransport
transport
=
http
.
DefaultTransport
}
}
}
}
if
config
.
WrapTransport
!=
nil
{
transport
=
config
.
WrapTransport
(
transport
)
}
transport
,
err
=
HTTPWrappersForConfig
(
config
,
transport
)
transport
,
err
=
HTTPWrappersForConfig
(
config
,
transport
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment