Documentation
¶
Index ¶
- type AgentTokenAuthenticationOptions
- type Backend
- type BackendManager
- type BackendStorage
- type DefaultBackendManager
- type DefaultBackendStorage
- func (s *DefaultBackendStorage) AddBackend(identifier string, idType pkgagent.IdentifierType, ...) Backend
- func (s *DefaultBackendStorage) GetRandomBackend() (Backend, error)
- func (s *DefaultBackendStorage) NumBackends() int
- func (s *DefaultBackendStorage) Ready() (bool, string)
- func (s *DefaultBackendStorage) RemoveBackend(identifier string, idType pkgagent.IdentifierType, ...)
- type DestHostBackendManager
- type ErrNotFound
- type ErrWrongIDType
- type PendingDialManager
- type ProxyClientConnection
- type ProxyServer
- type ProxyStrategy
- type ReadinessManager
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentTokenAuthenticationOptions ¶
type AgentTokenAuthenticationOptions struct { Enabled bool AgentNamespace string AgentServiceAccount string AuthenticationAudience string KubernetesClient kubernetes.Interface }
AgentTokenAuthenticationOptions contains list of parameters required for agent token based authentication
type BackendManager ¶
type BackendManager interface { // Backend returns a single backend. // WARNING: the context passed to the function should be a session-scoped // context instead of a request-scoped context, as the backend manager will // pick a backend for every tunnel session and each tunnel session may // contains multiple requests. Backend(ctx context.Context) (Backend, error) BackendStorage ReadinessManager }
BackendManager is an interface to manage backend connections, i.e., connection to the proxy agents.
type BackendStorage ¶ added in v0.0.13
type BackendStorage interface { // AddBackend adds a backend. AddBackend(identifier string, idType pkgagent.IdentifierType, conn agent.AgentService_ConnectServer) Backend // RemoveBackend removes a backend. RemoveBackend(identifier string, idType pkgagent.IdentifierType, conn agent.AgentService_ConnectServer) // NumBackends returns the number of backends. NumBackends() int }
BackendStorage is an interface to manage the storage of the backend connections, i.e., get, add and remove
type DefaultBackendManager ¶
type DefaultBackendManager struct {
*DefaultBackendStorage
}
DefaultBackendManager is the default backend manager.
func NewDefaultBackendManager ¶
func NewDefaultBackendManager() *DefaultBackendManager
NewDefaultBackendManager returns a DefaultBackendManager.
type DefaultBackendStorage ¶ added in v0.0.13
type DefaultBackendStorage struct {
// contains filtered or unexported fields
}
DefaultBackendStorage is the default backend storage.
func NewDefaultBackendStorage ¶ added in v0.0.13
func NewDefaultBackendStorage(idTypes []pkgagent.IdentifierType) *DefaultBackendStorage
NewDefaultBackendStorage returns a DefaultBackendStorage
func (*DefaultBackendStorage) AddBackend ¶ added in v0.0.13
func (s *DefaultBackendStorage) AddBackend(identifier string, idType pkgagent.IdentifierType, conn agent.AgentService_ConnectServer) Backend
AddBackend adds a backend.
func (*DefaultBackendStorage) GetRandomBackend ¶ added in v0.0.13
func (s *DefaultBackendStorage) GetRandomBackend() (Backend, error)
GetRandomBackend returns a random backend.
func (*DefaultBackendStorage) NumBackends ¶ added in v0.0.13
func (s *DefaultBackendStorage) NumBackends() int
NumBackends resturns the number of available backends
func (*DefaultBackendStorage) Ready ¶ added in v0.0.15
func (s *DefaultBackendStorage) Ready() (bool, string)
func (*DefaultBackendStorage) RemoveBackend ¶ added in v0.0.13
func (s *DefaultBackendStorage) RemoveBackend(identifier string, idType pkgagent.IdentifierType, conn agent.AgentService_ConnectServer)
RemoveBackend removes a backend.
type DestHostBackendManager ¶ added in v0.0.15
type DestHostBackendManager struct {
*DefaultBackendStorage
}
func NewDestHostBackendManager ¶ added in v0.0.15
func NewDestHostBackendManager() *DestHostBackendManager
type ErrWrongIDType ¶ added in v0.0.15
type ErrWrongIDType struct {
// contains filtered or unexported fields
}
func (*ErrWrongIDType) Error ¶ added in v0.0.15
func (e *ErrWrongIDType) Error() string
type PendingDialManager ¶
type PendingDialManager struct {
// contains filtered or unexported fields
}
func NewPendingDialManager ¶
func NewPendingDialManager() *PendingDialManager
func (*PendingDialManager) Add ¶
func (pm *PendingDialManager) Add(random int64, clientConn *ProxyClientConnection)
func (*PendingDialManager) Get ¶
func (pm *PendingDialManager) Get(random int64) (*ProxyClientConnection, bool)
func (*PendingDialManager) Remove ¶
func (pm *PendingDialManager) Remove(random int64)
type ProxyClientConnection ¶
type ProxyClientConnection struct { Mode string Grpc client.ProxyService_ProxyServer HTTP net.Conn // contains filtered or unexported fields }
type ProxyServer ¶
type ProxyServer struct { // BackendManagers contains a list of BackendManagers BackendManagers []BackendManager // Readiness reports if the proxy server is ready, i.e., if the proxy // server has connections to proxy agents (backends). Note that the // proxy server does not check the healthiness of the connections, // though the proxy agents do, so this readiness check might report // ready but there is no healthy connection. Readiness ReadinessManager PendingDial *PendingDialManager // agent authentication AgentAuthenticationOptions *AgentTokenAuthenticationOptions // contains filtered or unexported fields }
ProxyServer
func NewProxyServer ¶
func NewProxyServer(serverID string, proxyStrategies []ProxyStrategy, serverCount int, agentAuthenticationOptions *AgentTokenAuthenticationOptions) *ProxyServer
NewProxyServer creates a new ProxyServer instance
func (*ProxyServer) Connect ¶
func (s *ProxyServer) Connect(stream agent.AgentService_ConnectServer) error
Connect is for agent to connect to ProxyServer as next hop
func (*ProxyServer) Proxy ¶
func (s *ProxyServer) Proxy(stream client.ProxyService_ProxyServer) error
Proxy handles incoming streams from gRPC frontend.
type ProxyStrategy ¶ added in v0.0.15
type ProxyStrategy string
const ( // With this strategy the Proxy Server will randomly pick a backend from // the current healthy backends to establish the tunnel over which to // forward requests. ProxyStrategyDefault ProxyStrategy = "default" // With this strategy the Proxy Server will pick a backend that has the same // associated host as the request.Host to establish the tunnel. ProxyStrategyDestHost ProxyStrategy = "destHost" )
func GenProxyStrategiesFromStr ¶ added in v0.0.15
func GenProxyStrategiesFromStr(proxyStrategies string) ([]ProxyStrategy, error)
GenProxyStrategiesFromStr generates the list of proxy strategies from the comma-seperated string, i.e., destHost.
type ReadinessManager ¶ added in v0.0.11
type ReadinessManager interface { // Ready returns if the proxy server is ready. If not, also return an // error message. Ready() (bool, string) }
ReadinessManager supports checking if the proxy server is ready.
type Tunnel ¶
type Tunnel struct {
Server *ProxyServer
}
Tunnel implements Proxy based on HTTP Connect, which tunnels the traffic to the agent registered in ProxyServer.