Documentation
¶
Index ¶
- func NewSmartHTTPTransport(logWriter io.Writer, domains ...string) (*http.Transport, error)
- type Kindling
- type Option
- func WithAMPCache(c amp.Client) Option
- func WithDNSTunnel(d dnstt.DNSTT) Option
- func WithDomainFronting(f fronted.Fronted) Option
- func WithLogWriter(w io.Writer) Option
- func WithPanicListener(panicListener func(string)) Option
- func WithProxyless(domains ...string) Option
- func WithTransport(transport Transport) Option
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kindling ¶
type Kindling interface {
// NewHTTPClient returns a new HTTP client that is configured to use kindling.
NewHTTPClient() *http.Client
// ReplaceTransport replaces an existing transport RoundTripper generator with the provided one.
ReplaceTransport(name string, rt func(ctx context.Context, addr string) (http.RoundTripper, error)) error
}
Kindling is the interface that wraps the basic Dial and DialContext methods for control plane traffic.
func NewKindling ¶
NewKindling returns a new Kindling with the specified name of your tool and the options to use for accessing control plane data.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a functional option type that allows us to configure the Client.
func WithAMPCache ¶
WithAMPCache uses the AMP cache for making requests. It adds an 'amp' round tripper from the provided amp.Client.
func WithDNSTunnel ¶
WithDNSTunnel is a functional option that sets up a DNS tunnel for kindling using the provided dnstt.DNSTT instance
func WithDomainFronting ¶
WithDomainFronting is a functional option that sets up domain fronting for kindling using the provided fronted.Fronted instance from https://github.com/getlantern/fronted.
func WithLogWriter ¶
WithLogWriter is a functional option that sets the log writer for the Kindling. By default, the log writer is set to os.Stdout. This should be the first option to be applied to the Kindling to ensure that all logs are captured.
func WithPanicListener ¶
WithPanicListener is a functional option that sets a panic listener that should be notified whenever any goroutine panics. We set this with a higher priority so that it is set before any other options that may depend on it.
func WithProxyless ¶
WithProxyless is a functional option that enables proxyless mode for the Kindling such that it accesses the control plane directly using a variety of proxyless techniques.
func WithTransport ¶
WithTransport allows users to add any transport matching the minimal Transport interface.
type Transport ¶
type Transport interface {
// NewRoundTripper creates a new http.RoundTripper that uses this transport. As much as possible
// the RoundTripper should be pre-connected when it is returned, as otherwise it can take too
// much time away from other transports. In other words, Kindling parallelizes the connection
// of the transports, but the actual sending of the request is done serially to avoid
// issues with non-idempotent requests.
NewRoundTripper(ctx context.Context, addr string) (http.RoundTripper, error)
// MaxLength returns the maximum length of data that can be sent using this transport, if any.
// A value of 0 means there is no limit.
MaxLength() int
// IsStreamable returns if the transport support streaming
IsStreamable() bool
// Name returns the name of the transport for logging and debugging purposes.
Name() string
}
Transport provides the basic interface that any transport must implement to be used by Kindling.