Documentation ¶
Index ¶
- type Config
- type ConfigList
- type ConfigStore
- type Conn
- type ConnTrack
- type Error
- type FilterConfig
- type ResponseGen
- type Server
- func (s *Server) Close()
- func (s *Server) DeleteConfig(id string)
- func (s *Server) GetConfigChannel() chan Config
- func (s *Server) GetConfigStore() *ConfigStore
- func (s *Server) GetConnTrack() *ConnTrack
- func (s *Server) GetV1ConfigNamespaceName(w http.ResponseWriter, r *http.Request, namespace string, name string, ...)
- func (s *Server) ListV1Configs(w http.ResponseWriter, r *http.Request, params api.ListV1ConfigsParams)
- func (s *Server) ListV1ConfigsNamespace(w http.ResponseWriter, r *http.Request, namespace string, ...)
- func (s *Server) RemoveClient(id string)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) UpdateConfig(newConfigs []Config) error
- func (s *Server) UpsertConfig(id string, c *stnrv1.StunnerConfig)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Id string Config *stnrv1.StunnerConfig }
type ConfigList ¶
type ConfigList struct { Version string `json:"version"` Items []*stnrv1.StunnerConfig `json:"items"` }
type ConfigStore ¶
type ConfigStore struct {
// contains filtered or unexported fields
}
func NewConfigStore ¶
func NewConfigStore() *ConfigStore
func (*ConfigStore) Delete ¶
func (t *ConfigStore) Delete(id string)
func (*ConfigStore) Get ¶
func (t *ConfigStore) Get(id string) *stnrv1.StunnerConfig
func (*ConfigStore) Snapshot ¶
func (t *ConfigStore) Snapshot() []Config
func (*ConfigStore) Upsert ¶
func (t *ConfigStore) Upsert(id string, c *stnrv1.StunnerConfig)
type Conn ¶
type Conn struct { *websocket.Conn Filter FilterConfig // contains filtered or unexported fields }
Conn represents a client WebSocket connection.
func NewConn ¶
func NewConn(conn *websocket.Conn, filter FilterConfig) *Conn
NewConn wraps a WebSocket connection.
func (*Conn) ReadMessage ¶
ReadMessage reads a message from the client connection with proper locking.
type ConnTrack ¶
type ConnTrack struct {
// contains filtered or unexported fields
}
ConnTrack represents the server's connection tracking table.
func NewConnTrack ¶
func NewConnTrack() *ConnTrack
NewConnTrack creates a new connection tracking table.
type Error ¶
type Error struct { // Code Error code Code int32 `json:"code"` // Message Error message Message string `json:"message"` }
Error defines model for Error.
type FilterConfig ¶
FilterConfig is a callback to filter config updates for a client.
type ResponseGen ¶
ResponseGen is a callback to generate a response to a request (also used for sending the initial config dump for watches).
type Server ¶
Server is a generic config discovery server implementation.
func (*Server) Close ¶
func (s *Server) Close()
Close closes the server and drops all active connections.
func (*Server) DeleteConfig ¶
DeleteConfig should remove a config from the client. Theoretically, this would be done by sending the client a zero-config. However, in order to avoid that a client being removed and entering the graceful shutdown cycle receive a zeroconfig and abruprly kill all listeners with all active connections allocated to it, currently we suppress the config update.
func (*Server) GetConfigChannel ¶
GetConfigChannel returns the channel that can be used to add configs to the server's config store. Use Update to specify more configs at once.
func (*Server) GetConfigStore ¶
func (s *Server) GetConfigStore() *ConfigStore
GetConfigStore returns the dataplane configs stores in the server.
func (*Server) GetConnTrack ¶
GetConnTrack returns the client connection tracking table of the server.
func (*Server) GetV1ConfigNamespaceName ¶
func (s *Server) GetV1ConfigNamespaceName(w http.ResponseWriter, r *http.Request, namespace string, name string, params api.GetV1ConfigNamespaceNameParams)
(GET /api/v1/configs/{namespace}/{name})
func (*Server) ListV1Configs ¶
func (s *Server) ListV1Configs(w http.ResponseWriter, r *http.Request, params api.ListV1ConfigsParams)
(GET /api/v1/configs)
func (*Server) ListV1ConfigsNamespace ¶
func (s *Server) ListV1ConfigsNamespace(w http.ResponseWriter, r *http.Request, namespace string, params api.ListV1ConfigsNamespaceParams)
(GET /api/v1/configs/{namespace})
func (*Server) RemoveClient ¶
RemoveClient forcefully closes a client connection. This is used mainly for testing.
func (*Server) UpdateConfig ¶
UpdateConfig receives a set of ids and newConfigs that represent the state-of-the-world at a particular instance of time and generates an update per each change.
func (*Server) UpsertConfig ¶
func (s *Server) UpsertConfig(id string, c *stnrv1.StunnerConfig)
UpsertConfig upserts a single config in the server.