Documentation
¶
Index ¶
- Constants
- Variables
- func ExplodeLabelSetss(in []string) []*pb.LabelSet
- func ExplodeLabels(list string) *pb.LabelSet
- func FlattenLabelSets(sets []*pb.LabelSet) []string
- func FlattenLabels(labels *pb.LabelSet) string
- func GenerateSelfSignedTLS() (*tls.Certificate, error)
- func K8SConfig(path string) (*rest.Config, error)
- func NewConsulLockManager(ctx context.Context) (*consulLockMgr, error)
- type Account
- type ActivityInjector
- type ActivityLog
- type ActivityReader
- type Client
- func (c *Client) AddService(ctx context.Context, serv *pb.ServiceRequest) error
- func (c *Client) AllHubs(ctx context.Context) ([]*pb.HubInfo, error)
- func (c *Client) AuthToken() string
- func (c *Client) BootstrapConfig(ctx context.Context) error
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) ConnectToKubernetes() error
- func (c *Client) ForceLabelLinkUpdate(ctx context.Context, L hclog.Logger) error
- func (c *Client) GetHubAddresses(ctx context.Context, id *pb.ULID) ([]*pb.NetworkLocation, error)
- func (c *Client) Id() *pb.ULID
- func (c *Client) LearnLocations(def *pb.LabelSet) ([]*pb.NetworkLocation, error)
- func (c *Client) Locations() []*pb.NetworkLocation
- func (c *Client) LookupService(ctx context.Context, account *pb.Account, labels *pb.LabelSet) (*RouteCalculation, error)
- func (c *Client) NumLocalServices() int
- func (c *Client) RemoveService(ctx context.Context, serv *pb.ServiceRequest) error
- func (c *Client) RequestServiceToken(ctx context.Context, namespace string) (string, error)
- func (c *Client) ResolveLabelLink(label *pb.LabelSet) (*pb.Account, *pb.LabelSet, *pb.Account_Limits, error)
- func (c *Client) Run(ctx context.Context) error
- func (c *Client) RunIngress(ctx context.Context, li net.Listener, npn map[string]NPNHandler, ...) error
- func (c *Client) SendFlow(rec *pb.FlowRecord)
- func (c *Client) SetLocations(netloc []*pb.NetworkLocation)
- func (c *Client) StableId() *pb.ULID
- func (c *Client) TokenPub() ed25519.PublicKey
- type ClientConfig
- type FlowTop
- type FlowTopEntry
- type Hub
- type LabelLink
- type LockManager
- type LogCleaner
- type ManagementClient
- type NPNHandler
- type Peer
- type RouteCalculation
- type Server
- func (s *Server) AddAccount(ctx context.Context, req *pb.AddAccountRequest) (*pb.Noop, error)
- func (s *Server) AddLabelLink(ctx context.Context, req *pb.AddLabelLinkRequest) (*pb.Noop, error)
- func (s *Server) AddService(ctx context.Context, service *pb.ServiceRequest) (*pb.ServiceResponse, error)
- func (s *Server) AllHubs(ctx context.Context, _ *pb.Noop) (*pb.ListOfHubs, error)
- func (s *Server) CreateToken(ctx context.Context, req *pb.CreateTokenRequest) (*pb.CreateTokenResponse, error)
- func (s *Server) CurrentFlowTop(ctx context.Context, req *pb.FlowTopRequest) (*pb.FlowTopSnapshot, error)
- func (s *Server) FetchConfig(ctx context.Context, req *pb.ConfigRequest) (*pb.ConfigResponse, error)
- func (s *Server) GetAllNetworkLocations() ([]*pb.NetworkLocation, error)
- func (s *Server) GetManagementToken(ctx context.Context, namespace string) (string, error)
- func (s *Server) GetTokenPublicKey(ctx context.Context, _ *pb.Noop) (*pb.TokenInfo, error)
- func (s *Server) HubDisconnect(ctx context.Context, req *pb.HubDisconnectRequest) (*pb.Noop, error)
- func (s *Server) IssueHubToken(ctx context.Context, _ *pb.Noop) (*pb.CreateTokenResponse, error)
- func (s *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest) (*pb.ListAccountsResponse, error)
- func (s *Server) ListServices(ctx context.Context, req *pb.ListServicesRequest) (*pb.ListServicesResponse, error)
- func (s *Server) LookupEndpoints(ctx context.Context, req *pb.LookupEndpointsRequest) (*pb.LookupEndpointsResponse, error)
- func (s *Server) Register(ctx context.Context, reg *pb.ControlRegister) (*pb.ControlToken, error)
- func (s *Server) RemoveLabelLink(ctx context.Context, req *pb.RemoveLabelLinkRequest) (*pb.Noop, error)
- func (s *Server) RemoveService(ctx context.Context, service *pb.ServiceRequest) (*pb.ServiceResponse, error)
- func (s *Server) RequestServiceToken(ctx context.Context, req *pb.ServiceTokenRequest) (*pb.ServiceTokenResponse, error)
- func (s *Server) ResolveLabelLink(ctx context.Context, req *pb.ResolveLabelLinkRequest) (*pb.ResolveLabelLinkResponse, error)
- func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (s *Server) SetHubTLS(cert, key []byte, domain string)
- func (s *Server) StartActivityReader(ctx context.Context, dbtype, conn string) error
- func (s *Server) StreamActivity(stream pb.ControlServices_StreamActivityServer) error
- func (s *Server) SyncHub(ctx context.Context, sync *pb.HubSync) (*pb.HubSyncResponse, error)
- func (s *Server) TokenPub() ed25519.PublicKey
- type ServerConfig
- type Service
Constants ¶
View Source
const DefaultFlowTopSize = 100
View Source
const DefaultListAccountsLimit = 100
Variables ¶
View Source
var ErrBadAuthentication = errors.New("bad authentication information presented")
View Source
var ErrInvalidRequest = errors.New("invalid request")
View Source
var ErrLocked = errors.New("locked")
View Source
var LogPruneInterval = "6 hours"
Functions ¶
func ExplodeLabelSetss ¶
func ExplodeLabels ¶
func FlattenLabelSets ¶
func FlattenLabels ¶
func GenerateSelfSignedTLS ¶
func GenerateSelfSignedTLS() (*tls.Certificate, error)
func K8SConfig ¶
K8SConfig returns a *restclient.Config for initializing a K8S client. This configuration first attempts to load a local kubeconfig if a path is given. If that doesn't work, then in-cluster auth is used.
func NewConsulLockManager ¶
Types ¶
type ActivityInjector ¶
type ActivityInjector struct {
// contains filtered or unexported fields
}
func NewActivityInjector ¶
func NewActivityInjector(db *gorm.DB) (*ActivityInjector, error)
type ActivityLog ¶
type ActivityReader ¶
type ActivityReader struct {
C chan []*ActivityLog
// contains filtered or unexported fields
}
func NewActivityReader ¶
func NewActivityReader(ctx context.Context, dbtype, conn string) (*ActivityReader, error)
func (*ActivityReader) Close ¶
func (ar *ActivityReader) Close() error
type Client ¶
func (*Client) AddService ¶
func (*Client) ConnectToKubernetes ¶
func (*Client) ForceLabelLinkUpdate ¶
func (*Client) GetHubAddresses ¶
func (*Client) LearnLocations ¶
func (*Client) Locations ¶
func (c *Client) Locations() []*pb.NetworkLocation
func (*Client) LookupService ¶
func (*Client) NumLocalServices ¶
func (*Client) RemoveService ¶
func (*Client) RequestServiceToken ¶
func (*Client) ResolveLabelLink ¶
func (*Client) RunIngress ¶
func (*Client) SendFlow ¶
func (c *Client) SendFlow(rec *pb.FlowRecord)
func (*Client) SetLocations ¶
func (c *Client) SetLocations(netloc []*pb.NetworkLocation)
type ClientConfig ¶
type ClientConfig struct {
Logger hclog.Logger
InstanceId *pb.ULID
Id *pb.ULID
GRPCConn *grpc.ClientConn
Client pb.ControlServicesClient
Token string
Addr string
Version string
S3Bucket string
Session *session.Session
WorkDir string
Insecure bool
// The kubernetes deployment name used for the service using this client
K8Deployment string
// Where hub integrates it's handler for the hzn protocol
NextProto map[string]func(hs *http.Server, tlsConn *tls.Conn, h http.Handler)
FilterRoute func(*pb.ServiceRoute) bool
InsecureSkipVerify bool
}
type FlowTop ¶
type FlowTop struct {
// contains filtered or unexported fields
}
func NewFlowTop ¶
func (*FlowTop) Add ¶
func (f *FlowTop) Add(rec *pb.FlowStream)
func (*FlowTop) Export ¶
func (f *FlowTop) Export() ([]*FlowTopEntry, error)
type FlowTopEntry ¶
type FlowTopEntry struct {
// contains filtered or unexported fields
}
type Hub ¶
type Hub struct {
StableID []byte `gorm:"primary_key"`
InstanceID []byte
ConnectionInfo []byte
LastCheckin time.Time
CreatedAt time.Time
}
func (*Hub) StableIdULID ¶
type LockManager ¶
type LockManager interface {
GetLock(id, val string) (io.Closer, error)
GetValue(id string) (string, error)
}
Returns a lock for the given id.
type LogCleaner ¶
func (*LogCleaner) CleanupActivityLog ¶
func (l *LogCleaner) CleanupActivityLog(ctx context.Context, jobType string, _ *struct{}) error
type ManagementClient ¶
type RouteCalculation ¶
type RouteCalculation struct {
All []*pb.ServiceRoute
Best []*pb.ServiceRoute
// contains filtered or unexported fields
}
func (*RouteCalculation) Empty ¶
func (c *RouteCalculation) Empty() bool
func (*RouteCalculation) FindBest ¶
func (c *RouteCalculation) FindBest()
func (*RouteCalculation) Services ¶
func (c *RouteCalculation) Services() []*pb.ServiceRoute
type Server ¶
func NewServer ¶
func NewServer(cfg ServerConfig) (*Server, error)
func (*Server) AddAccount ¶
func (*Server) AddLabelLink ¶
func (*Server) AddService ¶
func (s *Server) AddService(ctx context.Context, service *pb.ServiceRequest) (*pb.ServiceResponse, error)
func (*Server) CreateToken ¶
func (s *Server) CreateToken(ctx context.Context, req *pb.CreateTokenRequest) (*pb.CreateTokenResponse, error)
func (*Server) CurrentFlowTop ¶
func (s *Server) CurrentFlowTop(ctx context.Context, req *pb.FlowTopRequest) (*pb.FlowTopSnapshot, error)
func (*Server) FetchConfig ¶
func (s *Server) FetchConfig(ctx context.Context, req *pb.ConfigRequest) (*pb.ConfigResponse, error)
func (*Server) GetAllNetworkLocations ¶
func (s *Server) GetAllNetworkLocations() ([]*pb.NetworkLocation, error)
func (*Server) GetManagementToken ¶
func (*Server) GetTokenPublicKey ¶
For management clients to be able valid horizon tokens themselves without having to ask the control tier. This allows management clients to piggy back their authentication off the horizon tokens as well.
func (*Server) HubDisconnect ¶
func (*Server) IssueHubToken ¶
func (*Server) ListAccounts ¶
func (s *Server) ListAccounts(ctx context.Context, req *pb.ListAccountsRequest) (*pb.ListAccountsResponse, error)
func (*Server) ListServices ¶
func (s *Server) ListServices(ctx context.Context, req *pb.ListServicesRequest) (*pb.ListServicesResponse, error)
func (*Server) LookupEndpoints ¶
func (s *Server) LookupEndpoints(ctx context.Context, req *pb.LookupEndpointsRequest) (*pb.LookupEndpointsResponse, error)
func (*Server) Register ¶
func (s *Server) Register(ctx context.Context, reg *pb.ControlRegister) (*pb.ControlToken, error)
func (*Server) RemoveLabelLink ¶
func (*Server) RemoveService ¶
func (s *Server) RemoveService(ctx context.Context, service *pb.ServiceRequest) (*pb.ServiceResponse, error)
func (*Server) RequestServiceToken ¶
func (s *Server) RequestServiceToken(ctx context.Context, req *pb.ServiceTokenRequest) (*pb.ServiceTokenResponse, error)
func (*Server) ResolveLabelLink ¶
func (s *Server) ResolveLabelLink(ctx context.Context, req *pb.ResolveLabelLinkRequest) (*pb.ResolveLabelLinkResponse, error)
func (*Server) StartActivityReader ¶
func (*Server) StreamActivity ¶
func (s *Server) StreamActivity(stream pb.ControlServices_StreamActivityServer) error
type ServerConfig ¶
type ServerConfig struct {
DB *gorm.DB
Logger hclog.Logger
RegisterToken string
OpsToken string
VaultClient *api.Client
VaultPath string
KeyId string
// If no vault client is specified, this is used instead.
SigningKey ed25519.PrivateKey
AwsSession *session.Session
Bucket string
ASNDB string
HubAccessKey string
HubSecretKey string
// The docker image that hubs should be used, this is advertised to the hubs
// so they can act on it.
HubImageTag string
DataDogAddr string
DisablePrometheus bool
LockManager LockManager
}
Click to show internal directories.
Click to hide internal directories.