client

package
v0.0.0-...-7d3c339 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultControlPlaneUnixSocketPath = "/opt/tyger/api.sock"
	DefaultControlPlaneUnixSocketUrl  = "http+unix://" + DefaultControlPlaneUnixSocketPath + ":"
)

Variables

This section is empty.

Functions

func CloneRetryableClient

func CloneRetryableClient(c *retryablehttp.Client) *retryablehttp.Client

func ParseProxy

func ParseProxy(proxyString string) (func(r *http.Request) (*url.URL, error), error)

func RedactHttpError

func RedactHttpError(err error) error

If the error is a *url.Error, redact the query string values in the error

func RedactUrl

func RedactUrl(u *url.URL) *url.URL

redact query string values

func SetDefaultNetworkClientSettings

func SetDefaultNetworkClientSettings(opts *ClientOptions) error

Types

type AccessTokenFunc

type AccessTokenFunc func(ctx context.Context) (string, error)

type Client

type Client struct {
	*retryablehttp.Client
	// contains filtered or unexported fields
}
var (
	DefaultClient          *Client
	DefaultRetryableClient *retryablehttp.Client
)

func NewClient

func NewClient(opts *ClientOptions) (*Client, error)

func NewControlPlaneClient

func NewControlPlaneClient(opts *ClientOptions) (*Client, error)

func NewDataPlaneClient

func NewDataPlaneClient(opts *ClientOptions) (*Client, error)

func (*Client) Proxy

func (c *Client) Proxy(req *http.Request) (*url.URL, error)

type ClientOptions

type ClientOptions struct {
	ProxyString                     string
	CreateTransport                 MakeRoundTripper
	CreateDialer                    MakeDialer
	DisableRetries                  bool
	DisableTlsCertificateValidation bool
}

type CommandTransport

type CommandTransport struct {
	// contains filtered or unexported fields
}

func (*CommandTransport) RoundTrip

func (c *CommandTransport) RoundTrip(req *http.Request) (*http.Response, error)

type DockerParams

type DockerParams struct {
	ContainerName string
	SocketPath    string
}

func ParseDockerUrl

func ParseDockerUrl(u *url.URL) (*DockerParams, error)

func (*DockerParams) FormatCmdLine

func (p *DockerParams) FormatCmdLine(add ...string) []string

func (*DockerParams) FormatLoginArgs

func (sp *DockerParams) FormatLoginArgs(add ...string) []string

func (*DockerParams) String

func (sp *DockerParams) String() string

func (*DockerParams) URL

func (p *DockerParams) URL() *url.URL

type HttpTransportOption

type HttpTransportOption func(*http.Transport)

type MakeDialer

type MakeDialer func(next dialContextFunc) dialContextFunc

type MakeRoundTripper

type MakeRoundTripper func(next http.RoundTripper) http.RoundTripper

func MakeCommandTransport

func MakeCommandTransport(concurrencyLimit int, command string, args ...string) MakeRoundTripper

type SshParams

type SshParams struct {
	Host       string
	Port       string
	User       string
	SocketPath string
	CliPath    string
}

func ParseSshUrl

func ParseSshUrl(u *url.URL) (*SshParams, error)

func (*SshParams) FormatCmdLine

func (sp *SshParams) FormatCmdLine(add ...string) []string

func (*SshParams) FormatDataPlaneCmdLine

func (sp *SshParams) FormatDataPlaneCmdLine(add ...string) []string

func (*SshParams) FormatLoginArgs

func (sp *SshParams) FormatLoginArgs(add ...string) []string

func (*SshParams) String

func (sp *SshParams) String() string

func (*SshParams) URL

func (sp *SshParams) URL() *url.URL

type TygerClient

type TygerClient struct {
	ControlPlaneUrl    *url.URL
	ControlPlaneClient *Client
	GetAccessToken     AccessTokenFunc
	DataPlaneClient    *Client
	Principal          string
	RawControlPlaneUrl *url.URL
	RawProxy           *url.URL
}

func (*TygerClient) ConnectionType

func (c *TygerClient) ConnectionType() TygerConnectionType

type TygerConnectionType

type TygerConnectionType int
const (
	TygerConnectionTypeTcp TygerConnectionType = iota
	TygerConnectionTypeUnix
	TygerConnectionTypeSsh
	TygerConnectionTypeDocker
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL