server

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 18 Imported by: 6

Documentation

Index

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 Backend

type Backend interface {
	Send(p *client.Packet) error
	Context() context.Context
}

type BackendManager

type BackendManager interface {
	// Backend returns a single backend.
	Backend() (Backend, error)
	// AddBackend adds a backend.
	AddBackend(agentID string, conn agent.AgentService_ConnectServer)
	// RemoveBackend removes a backend.
	RemoveBackend(agentID string, conn agent.AgentService_ConnectServer)
}

BackendManager is an interface to manage backend connections, i.e., connection to the proxy agents.

type DefaultBackendManager

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

DefaultBackendManager is the default backend manager.

func NewDefaultBackendManager

func NewDefaultBackendManager() *DefaultBackendManager

NewDefaultBackendManager returns a DefaultBackendManager.

func (*DefaultBackendManager) AddBackend

func (s *DefaultBackendManager) AddBackend(agentID string, conn agent.AgentService_ConnectServer)

AddBackend adds a backend.

func (*DefaultBackendManager) Backend

func (s *DefaultBackendManager) Backend() (Backend, error)

Backend returns a random backend.

func (*DefaultBackendManager) Ready added in v0.0.11

func (s *DefaultBackendManager) Ready() (bool, string)

func (*DefaultBackendManager) RemoveBackend

func (s *DefaultBackendManager) RemoveBackend(agentID string, conn agent.AgentService_ConnectServer)

RemoveBackend removes a backend.

type ErrNotFound

type ErrNotFound struct{}

ErrNotFound indicates that no backend can be found.

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

Error returns the error message.

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
}

ProxyClientConnection...

type ProxyServer

type ProxyServer struct {
	// BackendManager manages the backends.
	BackendManager 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, serverCount int, agentAuthenticationOptions *AgentTokenAuthenticationOptions) *ProxyServer

NewProxyServer creates a new ProxyServer instance

func (*ProxyServer) Connect

Connect is for agent to connect to ProxyServer as next hop

func (*ProxyServer) Proxy

Proxy handles incoming streams from gRPC frontend.

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.

func (*Tunnel) ServeHTTP

func (t *Tunnel) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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