Skip to content

Commit

Permalink
simply
Browse files Browse the repository at this point in the history
simply
  • Loading branch information
jiuker committed Jul 9, 2024
1 parent 0009f32 commit 9640db0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,23 +686,19 @@ func (rtw *roundTripperWrapper) renew() {
}

func (rtw *roundTripperWrapper) RoundTrip(req *http.Request) (*http.Response, error) {
rtw.rwLocker.RLock()
isNil := rtw.transport == nil
rtw.rwLocker.RUnlock()
if isNil {
rtw.renew()
}
return rtw.transport.RoundTrip(req)
}

func clientTransport(ctx *cli.Context, enableTLS bool) http.RoundTripper {
return &roundTripperWrapper{
tr := &roundTripperWrapper{
enableTLS: enableTLS,
cacert: ctx.GlobalString("cacert"),
clientCert: ctx.GlobalString("client-cert"),
clientKey: ctx.GlobalString("client-key"),
insecure: ctx.GlobalBool("insecure"),
}
tr.renew()
return tr
}

func checkMain(ctx *cli.Context) {
Expand Down

0 comments on commit 9640db0

Please sign in to comment.