Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–23 unchanged (23 lines)
24 weakrand "math/rand"
25 "net"
26 "net/http"
27 "net/url"
28 "os"
29 "reflect"
30 "strings"
31 "time"
32
33 "github.com/pires/go-proxyproto"
34 "github.com/quic-go/quic-go/http3"
35 "go.uber.org/zap"
36 "go.uber.org/zap/zapcore"
…lines 37–377 unchanged (341 lines)
378 }
379
380 if h.Compression != nil {
381 rt.DisableCompression = !*h.Compression
382 }
383
384 if sliceContains(h.Versions, "2") {
385 if err := http2.ConfigureTransport(rt); err != nil {
386 return nil, err
387 }
388 }
389
390 // configure HTTP/3 transport if enabled; however, this does not
391 // automatically fall back to lower versions like most web browsers
392 // do (that'd add latency and complexity, besides, we expect that
393 // site owners control the backends), so it must be exclusive
394 if len(h.Versions) == 1 && h.Versions[0] == "3" {
395 h.h3Transport = new(http3.RoundTripper)
396 if h.TLS != nil {
397 var err error
398 h.h3Transport.TLSClientConfig, err = h.TLS.MakeTLSClientConfig(caddyCtx)
399 if err != nil {
400 return nil, fmt.Errorf("making TLS client config for HTTP/3 transport: %v", err)
401 }
402 }
403 } else if len(h.Versions) > 1 && sliceContains(h.Versions, "3") {
404 return nil, fmt.Errorf("if HTTP/3 is enabled to the upstream, no other HTTP versions are supported")
405 }
406
407 // if h2c is enabled, configure its transport (std lib http.Transport
408 // does not "HTTP/2 over cleartext TCP")
409 if sliceContains(h.Versions, "h2c") {
410 // crafting our own http2.Transport doesn't allow us to utilize
411 // most of the customizations/preferences on the http.Transport,
412 // because, for some reason, only http2.ConfigureTransport()
413 // is allowed to set the unexported field that refers to a base
414 // http.Transport config; oh well
415 h2t := &http2.Transport{
416 // kind of a hack, but for plaintext/H2C requests, pretend to dial TLS
417 DialTLSContext: func(ctx context.Context, network, address string, _ *tls.Config) (net.Conn, error) {
418 return dialContext(ctx, network, address)
419 },
420 AllowHTTP: true,
421 }
422 if h.Compression != nil {
423 h2t.DisableCompression = !*h.Compression
424 }
425 h.h2cTransport = h2t
426 }
427
428 return rt, nil
429}
430
431// replaceTLSServername checks TLS servername to see if it needs replacing
432// if it does need replacing, it creates a new cloned HTTPTransport object to avoid any races
…lines 433–779 unchanged (347 lines)
780 }
781
782 // parse the DER-encoded certificate
783 return x509.ParseCertificate(derBytes)
784}
785
786// sliceContains returns true if needle is in haystack.
787func sliceContains(haystack []string, needle string) bool {
788 for _, s := range haystack {
789 if s == needle {
790 return true
791 }
792 }
793 return false
794}
795
796// Interface guards
797var (
798 _ caddy.Provisioner = (*HTTPTransport)(nil)
799 _ http.RoundTripper = (*HTTPTransport)(nil)
800 _ caddy.CleanerUpper = (*HTTPTransport)(nil)
801 _ TLSTransport = (*HTTPTransport)(nil)
802)
803

After

…lines 1–23 unchanged (23 lines)
24 weakrand "math/rand"
25 "net"
26 "net/http"
27 "net/url"
28 "os"
29 "reflect"
30 "slices"
31 "strings"
32 "time"
33
34 "github.com/pires/go-proxyproto"
35 "github.com/quic-go/quic-go/http3"
36 "go.uber.org/zap"
…lines 37–378 unchanged (342 lines)
379 }
380
381 if h.Compression != nil {
382 rt.DisableCompression = !*h.Compression
383 }
384
385 if slices.Contains(h.Versions, "2") {
386 if err := http2.ConfigureTransport(rt); err != nil {
387 return nil, err
388 }
389 }
390
391 // configure HTTP/3 transport if enabled; however, this does not
392 // automatically fall back to lower versions like most web browsers
393 // do (that'd add latency and complexity, besides, we expect that
394 // site owners control the backends), so it must be exclusive
395 if len(h.Versions) == 1 && h.Versions[0] == "3" {
396 h.h3Transport = new(http3.RoundTripper)
397 if h.TLS != nil {
398 var err error
399 h.h3Transport.TLSClientConfig, err = h.TLS.MakeTLSClientConfig(caddyCtx)
400 if err != nil {
401 return nil, fmt.Errorf("making TLS client config for HTTP/3 transport: %v", err)
402 }
403 }
404 } else if len(h.Versions) > 1 && slices.Contains(h.Versions, "3") {
405 return nil, fmt.Errorf("if HTTP/3 is enabled to the upstream, no other HTTP versions are supported")
406 }
407
408 // if h2c is enabled, configure its transport (std lib http.Transport
409 // does not "HTTP/2 over cleartext TCP")
410 if slices.Contains(h.Versions, "h2c") {
411 // crafting our own http2.Transport doesn't allow us to utilize
412 // most of the customizations/preferences on the http.Transport,
413 // because, for some reason, only http2.ConfigureTransport()
414 // is allowed to set the unexported field that refers to a base
415 // http.Transport config; oh well
416 h2t := &http2.Transport{
417 // kind of a hack, but for plaintext/H2C requests, pretend to dial TLS
418 DialTLSContext: func(ctx context.Context, network, address string, _ *tls.Config) (net.Conn, error) {
419 return dialContext(ctx, network, address)
420 },
421 AllowHTTP: true,
422 }
423 if h.Compression != nil {
424 h2t.DisableCompression = !*h.Compression
425 }
426 h.h2cTransport = h2t
427 }
428
429 return rt, nil
430}
431
432// replaceTLSServername checks TLS servername to see if it needs replacing
433// if it does need replacing, it creates a new cloned HTTPTransport object to avoid any races
…lines 434–779 unchanged (346 lines)
780 return nil, err
781 }
782
783 // parse the DER-encoded certificate
784 return x509.ParseCertificate(derBytes)
785}
786
787// Interface guards
788var (
789 _ caddy.Provisioner = (*HTTPTransport)(nil)
790 _ http.RoundTripper = (*HTTPTransport)(nil)
791 _ caddy.CleanerUpper = (*HTTPTransport)(nil)
792 _ TLSTransport = (*HTTPTransport)(nil)
793)
794

Before

source_file
comment "// Copyright 2015 Matthew Holt and The Caddy Authors"
comment "//"
comment "// Licensed under the Apache License, Version 2.0 (the \"Lice"...
comment "// you may not use this file except in compliance with the L"...
comment "// You may obtain a copy of the License at"
comment "//"
comment "// http://www.apache.org/licenses/LICENSE-2.0"
comment "//"
comment "// Unless required by applicable law or agreed to in writing"...
comment "// distributed under the License is distributed on an \"AS IS"...
comment "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expr"...
comment "// See the License for the specific language governing permi"...
comment "// limitations under the License."
package_clause
package "package"
package_identifier "reverseproxy"
import_declaration
import "import"
import_spec_list
( "("
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "context"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "crypto/tls"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "crypto/x509"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "encoding/base64"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "encoding/json"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "fmt"
" "\""
import_spec
package_identifier "weakrand"
interpreted_string_literal
" "\""
interpreted_string_literal_content "math/rand"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net/http"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net/url"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "os"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "reflect"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "strings"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "time"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/pires/go-proxyproto"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/quic-go/quic-go/http3"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "go.uber.org/zap"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "go.uber.org/zap/zapcore"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "golang.org/x/net/http2"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2/modules/caddyhttp"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2/modules/caddytls"
" "\""
) ")"
function_declaration (+24 nodes collapsed)
comment "// HTTPTransport is essentially a configuration wrapper for "...
comment "// It defines a JSON structure useful when configuring the H"...
comment "// for Caddy's reverse proxy. It builds its http.Transport a"...
type_declaration (+245 nodes collapsed)
comment "// CaddyModule returns the Caddy module information."
method_declaration (+68 nodes collapsed)
comment "// Provision sets up h.Transport with a *http.Transport"
comment "// that is ready to use."
method_declaration (+113 nodes collapsed)
comment "// NewTransport builds a standard-lib-compatible http.Transp"...
method_declaration
func "func"
parameter_list
( "("
parameter_declaration
identifier "h"
pointer_type
* "*"
type_identifier "HTTPTransport"
) ")"
field_identifier "NewTransport"
parameter_list
( "("
parameter_declaration
identifier "caddyCtx"
qualified_type
package_identifier "caddy"
. "."
type_identifier "Context"
) ")"
parameter_list
( "("
parameter_declaration
pointer_type
* "*"
qualified_type
package_identifier "http"
. "."
type_identifier "Transport"
, ","
parameter_declaration
type_identifier "error"
) ")"
block
{ "{"
comment "// Set keep-alive defaults if it wasn't otherwise configured"
statement_list
if_statement (+78 nodes collapsed)
comment "// Set a relatively short default dial timeout."
comment "// This is helpful to make load-balancer retries more speedy"...
if_statement (+36 nodes collapsed)
short_var_declaration (+51 nodes collapsed)
if_statement (+290 nodes collapsed)
if_statement (+222 nodes collapsed)
short_var_declaration (+776 nodes collapsed)
comment "// negotiate any HTTP/SOCKS proxy for the HTTP transport"
var_declaration (+29 nodes collapsed)
if_statement (+129 nodes collapsed)
short_var_declaration (+105 nodes collapsed)
if_statement (+92 nodes collapsed)
if_statement (+124 nodes collapsed)
comment "// The proxy protocol header can only be sent once right aft"...
comment "// So single connection must not be used for multiple reques"...
comment "// come from different clients."
if_statement (+52 nodes collapsed)
if_statement (+29 nodes collapsed)
if_statement
if "if"
call_expression
identifier "sliceContains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "2"
" "\""
) ")"
block (+35 nodes collapsed)
comment "// configure HTTP/3 transport if enabled; however, this does"...
comment "// automatically fall back to lower versions like most web b"...
comment "// do (that'd add latency and complexity, besides, we expect"...
comment "// site owners control the backends), so it must be exclusi"...
if_statement
if "if"
binary_expression (+28 nodes collapsed)
block (+93 nodes collapsed)
else "else"
if_statement
if "if"
binary_expression
binary_expression
call_expression
identifier "len"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
) ")"
> ">"
int_literal "1"
&& "&&"
call_expression
identifier "sliceContains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "3"
" "\""
) ")"
block (+21 nodes collapsed)
comment "// if h2c is enabled, configure its transport (std lib http."...
comment "// does not \"HTTP/2 over cleartext TCP\")"
if_statement
if "if"
call_expression
identifier "sliceContains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "h2c"
" "\""
) ")"
block (+130 nodes collapsed)
return_statement
return "return"
expression_list
identifier "rt"
, ","
nil "nil"
} "}"
comment "// replaceTLSServername checks TLS servername to see if it n"...
comment "// if it does need replacing, it creates a new cloned HTTPTr"...
comment "// and does the replacing of the TLS servername on that and "...
comment "// if no replacement is necessary it returns the original"
method_declaration (+280 nodes collapsed)
comment "// RoundTrip implements http.RoundTripper."
method_declaration (+204 nodes collapsed)
comment "// SetScheme ensures that the outbound request req"
comment "// has the scheme set in its URL; the underlying"
comment "// http.Transport requires a scheme to be set."
comment "//"
comment "// This method may be used by other transport modules"
comment "// that wrap/use this one."
method_declaration (+96 nodes collapsed)
comment "// shouldUseTLS returns true if TLS should be used for req."
method_declaration (+106 nodes collapsed)
comment "// TLSEnabled returns true if TLS is enabled."
method_declaration (+27 nodes collapsed)
comment "// EnableTLS enables TLS on the transport."
method_declaration (+37 nodes collapsed)
comment "// Cleanup implements caddy.CleanerUpper and closes any idle"...
method_declaration (+50 nodes collapsed)
comment "// TLSConfig holds configuration related to the TLS configur"...
comment "// transport/client."
type_declaration (+146 nodes collapsed)
comment "// MakeTLSClientConfig returns a tls.Config usable by a clie"...
comment "// If there is no custom TLS configuration, a nil config may"...
method_declaration (+1198 nodes collapsed)
comment "// KeepAlive holds configuration pertaining to HTTP Keep-Ali"...
type_declaration (+57 nodes collapsed)
comment "// tcpRWTimeoutConn enforces read/write timeouts for a TCP c"...
comment "// If it fails to set deadlines, the error is logged but doe"...
comment "// the read/write attempt (ignoring the error is consistent "...
comment "// the standard library does: https://github.com/golang/go/b"...
type_declaration (+31 nodes collapsed)
method_declaration (+159 nodes collapsed)
method_declaration (+159 nodes collapsed)
comment "// decodeBase64DERCert base64-decodes, then DER-decodes, cer"...
function_declaration (+75 nodes collapsed)
comment "// sliceContains returns true if needle is in haystack."
function_declaration
func "func"
identifier "sliceContains"
parameter_list
( "("
parameter_declaration
identifier "haystack"
slice_type
[ "["
] "]"
type_identifier "string"
, ","
parameter_declaration
identifier "needle"
type_identifier "string"
) ")"
type_identifier "bool"
block
{ "{"
statement_list
for_statement
for "for"
range_clause
expression_list
identifier "_"
, ","
identifier "s"
:= ":="
range "range"
identifier "haystack"
block
{ "{"
statement_list
if_statement
if "if"
binary_expression
identifier "s"
== "=="
identifier "needle"
block
{ "{"
statement_list
return_statement
return "return"
expression_list
true "true"
} "}"
} "}"
return_statement
return "return"
expression_list
false "false"
} "}"
comment "// Interface guards"
var_declaration (+78 nodes collapsed)

After

source_file
comment "// Copyright 2015 Matthew Holt and The Caddy Authors"
comment "//"
comment "// Licensed under the Apache License, Version 2.0 (the \"Lice"...
comment "// you may not use this file except in compliance with the L"...
comment "// You may obtain a copy of the License at"
comment "//"
comment "// http://www.apache.org/licenses/LICENSE-2.0"
comment "//"
comment "// Unless required by applicable law or agreed to in writing"...
comment "// distributed under the License is distributed on an \"AS IS"...
comment "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expr"...
comment "// See the License for the specific language governing permi"...
comment "// limitations under the License."
package_clause
package "package"
package_identifier "reverseproxy"
import_declaration
import "import"
import_spec_list
( "("
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "context"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "crypto/tls"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "crypto/x509"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "encoding/base64"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "encoding/json"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "fmt"
" "\""
import_spec
package_identifier "weakrand"
interpreted_string_literal
" "\""
interpreted_string_literal_content "math/rand"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net/http"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "net/url"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "os"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "reflect"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "slices"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "strings"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "time"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/pires/go-proxyproto"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/quic-go/quic-go/http3"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "go.uber.org/zap"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "go.uber.org/zap/zapcore"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "golang.org/x/net/http2"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2/modules/caddyhttp"
" "\""
import_spec
interpreted_string_literal
" "\""
interpreted_string_literal_content "github.com/caddyserver/caddy/v2/modules/caddytls"
" "\""
) ")"
function_declaration (+24 nodes collapsed)
comment "// HTTPTransport is essentially a configuration wrapper for "...
comment "// It defines a JSON structure useful when configuring the H"...
comment "// for Caddy's reverse proxy. It builds its http.Transport a"...
type_declaration (+245 nodes collapsed)
comment "// CaddyModule returns the Caddy module information."
method_declaration (+68 nodes collapsed)
comment "// Provision sets up h.Transport with a *http.Transport"
comment "// that is ready to use."
method_declaration (+113 nodes collapsed)
comment "// NewTransport builds a standard-lib-compatible http.Transp"...
method_declaration
func "func"
parameter_list
( "("
parameter_declaration
identifier "h"
pointer_type
* "*"
type_identifier "HTTPTransport"
) ")"
field_identifier "NewTransport"
parameter_list
( "("
parameter_declaration
identifier "caddyCtx"
qualified_type
package_identifier "caddy"
. "."
type_identifier "Context"
) ")"
parameter_list
( "("
parameter_declaration
pointer_type
* "*"
qualified_type
package_identifier "http"
. "."
type_identifier "Transport"
, ","
parameter_declaration
type_identifier "error"
) ")"
block
{ "{"
comment "// Set keep-alive defaults if it wasn't otherwise configured"
statement_list
if_statement (+78 nodes collapsed)
comment "// Set a relatively short default dial timeout."
comment "// This is helpful to make load-balancer retries more speedy"...
if_statement (+36 nodes collapsed)
short_var_declaration (+51 nodes collapsed)
if_statement (+290 nodes collapsed)
if_statement (+222 nodes collapsed)
short_var_declaration (+776 nodes collapsed)
comment "// negotiate any HTTP/SOCKS proxy for the HTTP transport"
var_declaration (+29 nodes collapsed)
if_statement (+129 nodes collapsed)
short_var_declaration (+105 nodes collapsed)
if_statement (+92 nodes collapsed)
if_statement (+124 nodes collapsed)
comment "// The proxy protocol header can only be sent once right aft"...
comment "// So single connection must not be used for multiple reques"...
comment "// come from different clients."
if_statement (+52 nodes collapsed)
if_statement (+29 nodes collapsed)
if_statement
if "if"
call_expression
selector_expression
identifier "slices"
. "."
field_identifier "Contains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "2"
" "\""
) ")"
block (+35 nodes collapsed)
comment "// configure HTTP/3 transport if enabled; however, this does"...
comment "// automatically fall back to lower versions like most web b"...
comment "// do (that'd add latency and complexity, besides, we expect"...
comment "// site owners control the backends), so it must be exclusi"...
if_statement
if "if"
binary_expression (+28 nodes collapsed)
block (+93 nodes collapsed)
else "else"
if_statement
if "if"
binary_expression
binary_expression
call_expression
identifier "len"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
) ")"
> ">"
int_literal "1"
&& "&&"
call_expression
selector_expression
identifier "slices"
. "."
field_identifier "Contains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "3"
" "\""
) ")"
block (+21 nodes collapsed)
comment "// if h2c is enabled, configure its transport (std lib http."...
comment "// does not \"HTTP/2 over cleartext TCP\")"
if_statement
if "if"
call_expression
selector_expression
identifier "slices"
. "."
field_identifier "Contains"
argument_list
( "("
selector_expression
identifier "h"
. "."
field_identifier "Versions"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "h2c"
" "\""
) ")"
block (+130 nodes collapsed)
return_statement
return "return"
expression_list
identifier "rt"
, ","
nil "nil"
} "}"
comment "// replaceTLSServername checks TLS servername to see if it n"...
comment "// if it does need replacing, it creates a new cloned HTTPTr"...
comment "// and does the replacing of the TLS servername on that and "...
comment "// if no replacement is necessary it returns the original"
method_declaration (+280 nodes collapsed)
comment "// RoundTrip implements http.RoundTripper."
method_declaration (+204 nodes collapsed)
comment "// SetScheme ensures that the outbound request req"
comment "// has the scheme set in its URL; the underlying"
comment "// http.Transport requires a scheme to be set."
comment "//"
comment "// This method may be used by other transport modules"
comment "// that wrap/use this one."
method_declaration (+96 nodes collapsed)
comment "// shouldUseTLS returns true if TLS should be used for req."
method_declaration (+106 nodes collapsed)
comment "// TLSEnabled returns true if TLS is enabled."
method_declaration (+27 nodes collapsed)
comment "// EnableTLS enables TLS on the transport."
method_declaration (+37 nodes collapsed)
comment "// Cleanup implements caddy.CleanerUpper and closes any idle"...
method_declaration (+50 nodes collapsed)
comment "// TLSConfig holds configuration related to the TLS configur"...
comment "// transport/client."
type_declaration (+146 nodes collapsed)
comment "// MakeTLSClientConfig returns a tls.Config usable by a clie"...
comment "// If there is no custom TLS configuration, a nil config may"...
method_declaration (+1198 nodes collapsed)
comment "// KeepAlive holds configuration pertaining to HTTP Keep-Ali"...
type_declaration (+57 nodes collapsed)
comment "// tcpRWTimeoutConn enforces read/write timeouts for a TCP c"...
comment "// If it fails to set deadlines, the error is logged but doe"...
comment "// the read/write attempt (ignoring the error is consistent "...
comment "// the standard library does: https://github.com/golang/go/b"...
type_declaration (+31 nodes collapsed)
method_declaration (+159 nodes collapsed)
method_declaration (+159 nodes collapsed)
comment "// decodeBase64DERCert base64-decodes, then DER-decodes, cer"...
function_declaration (+75 nodes collapsed)
comment "// Interface guards"
var_declaration (+78 nodes collapsed)