Documentation
¶
Index ¶
- Constants
- Variables
- type AuthenticationBackend
- type AuthenticationClient
- type AuthenticationOpts
- type BasicAuthenticationBackend
- type CrudClient
- func (c *CrudClient) Create(resource string, value interface{}) error
- func (c *CrudClient) Delete(resource string, id string) error
- func (c *CrudClient) Get(resource string, id string, value interface{}) error
- func (c *CrudClient) List(resource string, values interface{}) error
- func (c *CrudClient) Update(resource string, id string, value interface{}) error
- type DefaultWSClientEventHandler
- type DefaultWSServerEventHandler
- type KeystoneAuthenticationBackend
- type NoAuthenticationBackend
- type PathPrefix
- type RestClient
- type Route
- type Server
- type User
- type WSAsyncClient
- type WSClient
- type WSClientEventHandler
- type WSMessage
- type WSServer
- func (s *WSServer) AddEventHandler(h WSServerEventHandler)
- func (s *WSServer) BroadcastWSMessage(msg *WSMessage)
- func (s *WSServer) GetClients() (clients []*WSClient)
- func (s *WSServer) GetClientsByType(kind string) (clients []*WSClient)
- func (s *WSServer) ListenAndServe()
- func (s *WSServer) SendWSMessageTo(msg *WSMessage, host string) bool
- func (s *WSServer) Stop()
- type WSServerEventHandler
Constants ¶
View Source
const (
Namespace = "WSServer"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthenticationBackend ¶
type AuthenticationBackend interface {
Authenticate(username string, password string) (string, error)
Wrap(wrapped auth.AuthenticatedHandlerFunc) http.HandlerFunc
}
func NewAuthenticationBackendFromConfig ¶
func NewAuthenticationBackendFromConfig() (AuthenticationBackend, error)
type AuthenticationClient ¶
type AuthenticationClient struct {
Addr string
Port int
AuthToken string
// contains filtered or unexported fields
}
func NewAuthenticationClient ¶
func NewAuthenticationClient(addr string, port int, authOptions *AuthenticationOpts) *AuthenticationClient
func (*AuthenticationClient) Authenticate ¶
func (c *AuthenticationClient) Authenticate() error
func (*AuthenticationClient) Authenticated ¶
func (c *AuthenticationClient) Authenticated() bool
func (*AuthenticationClient) Cookie ¶
func (c *AuthenticationClient) Cookie() *http.Cookie
func (*AuthenticationClient) SetHeaders ¶
func (c *AuthenticationClient) SetHeaders(headers http.Header)
type BasicAuthenticationBackend ¶
type BasicAuthenticationBackend struct {
*auth.BasicAuth
}
func NewBasicAuthenticationBackend ¶
func NewBasicAuthenticationBackend(file string) (*BasicAuthenticationBackend, error)
func NewBasicAuthenticationBackendFromConfig ¶
func NewBasicAuthenticationBackendFromConfig() (*BasicAuthenticationBackend, error)
func (*BasicAuthenticationBackend) Authenticate ¶
func (b *BasicAuthenticationBackend) Authenticate(username string, password string) (string, error)
func (*BasicAuthenticationBackend) Wrap ¶
func (b *BasicAuthenticationBackend) Wrap(wrapped auth.AuthenticatedHandlerFunc) http.HandlerFunc
type CrudClient ¶
type CrudClient struct {
RestClient
Root string
}
func NewCrudClient ¶
func NewCrudClient(addr string, port int, authOpts *AuthenticationOpts, root string) *CrudClient
func NewCrudClientFromConfig ¶
func NewCrudClientFromConfig(authOpts *AuthenticationOpts, root string) (*CrudClient, error)
func (*CrudClient) Create ¶
func (c *CrudClient) Create(resource string, value interface{}) error
func (*CrudClient) Delete ¶
func (c *CrudClient) Delete(resource string, id string) error
func (*CrudClient) Get ¶
func (c *CrudClient) Get(resource string, id string, value interface{}) error
func (*CrudClient) List ¶
func (c *CrudClient) List(resource string, values interface{}) error
func (*CrudClient) Update ¶
func (c *CrudClient) Update(resource string, id string, value interface{}) error
type DefaultWSClientEventHandler ¶
type DefaultWSClientEventHandler struct {
}
func (*DefaultWSClientEventHandler) OnConnected ¶
func (d *DefaultWSClientEventHandler) OnConnected()
func (*DefaultWSClientEventHandler) OnDisconnected ¶
func (d *DefaultWSClientEventHandler) OnDisconnected()
func (*DefaultWSClientEventHandler) OnMessage ¶
func (d *DefaultWSClientEventHandler) OnMessage(m WSMessage)
type DefaultWSServerEventHandler ¶
type DefaultWSServerEventHandler struct {
}
func (*DefaultWSServerEventHandler) OnMessage ¶
func (d *DefaultWSServerEventHandler) OnMessage(c *WSClient, m WSMessage)
func (*DefaultWSServerEventHandler) OnRegisterClient ¶
func (d *DefaultWSServerEventHandler) OnRegisterClient(c *WSClient)
func (*DefaultWSServerEventHandler) OnUnregisterClient ¶
func (d *DefaultWSServerEventHandler) OnUnregisterClient(c *WSClient)
type KeystoneAuthenticationBackend ¶
func NewKeystoneAuthenticationBackendFromConfig ¶
func NewKeystoneAuthenticationBackendFromConfig() *KeystoneAuthenticationBackend
func NewKeystoneBackend ¶
func NewKeystoneBackend(authURL string, tenant string, domain string) *KeystoneAuthenticationBackend
func (*KeystoneAuthenticationBackend) Authenticate ¶
func (b *KeystoneAuthenticationBackend) Authenticate(username string, password string) (string, error)
func (*KeystoneAuthenticationBackend) CheckUser ¶
func (b *KeystoneAuthenticationBackend) CheckUser(r *http.Request) (string, error)
func (*KeystoneAuthenticationBackend) Wrap ¶
func (b *KeystoneAuthenticationBackend) Wrap(wrapped auth.AuthenticatedHandlerFunc) http.HandlerFunc
type NoAuthenticationBackend ¶
type NoAuthenticationBackend struct {
}
func NewNoAuthenticationBackend ¶
func NewNoAuthenticationBackend() *NoAuthenticationBackend
func (*NoAuthenticationBackend) Authenticate ¶
func (h *NoAuthenticationBackend) Authenticate(username string, password string) (string, error)
func (*NoAuthenticationBackend) Wrap ¶
func (h *NoAuthenticationBackend) Wrap(wrapped auth.AuthenticatedHandlerFunc) http.HandlerFunc
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient(addr string, port int, authOptions *AuthenticationOpts) *RestClient
func NewRestClientFromConfig ¶
func NewRestClientFromConfig(authOptions *AuthenticationOpts) (*RestClient, error)
type Route ¶
type Server ¶
type Server struct {
Service string
Router *mux.Router
Addr string
Port int
Auth AuthenticationBackend
// contains filtered or unexported fields
}
func (*Server) HandleFunc ¶
type User ¶ added in v0.9.0
type WSAsyncClient ¶
type WSAsyncClient struct {
sync.RWMutex
Addr string
Port int
Path string
AuthClient *AuthenticationClient
// contains filtered or unexported fields
}
func NewWSAsyncClient ¶
func NewWSAsyncClient(hostID string, clientType string, addr string, port int, path string, authClient *AuthenticationClient) (*WSAsyncClient, error)
func NewWSAsyncClientFromConfig ¶
func NewWSAsyncClientFromConfig(clientType string, addr string, port int, path string, authClient *AuthenticationClient) (*WSAsyncClient, error)
func (*WSAsyncClient) AddEventHandler ¶
func (c *WSAsyncClient) AddEventHandler(h WSClientEventHandler)
func (*WSAsyncClient) Connect ¶
func (c *WSAsyncClient) Connect()
func (*WSAsyncClient) Disconnect ¶
func (c *WSAsyncClient) Disconnect()
func (*WSAsyncClient) IsConnected ¶
func (c *WSAsyncClient) IsConnected() bool
func (*WSAsyncClient) SendWSMessage ¶
func (c *WSAsyncClient) SendWSMessage(m *WSMessage)
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
type WSClientEventHandler ¶
type WSClientEventHandler interface {
OnMessage(m WSMessage)
OnConnected()
OnDisconnected()
}
type WSMessage ¶
type WSMessage struct {
Namespace string
Type string
UUID string `json:",omitempty"`
Obj *json.RawMessage
Status int
}
func NewWSMessage ¶
func (*WSMessage) Reply ¶
type WSServer ¶
type WSServer struct {
sync.RWMutex
DefaultWSServerEventHandler
Server *Server
// contains filtered or unexported fields
}
func NewWSServer ¶
func (*WSServer) AddEventHandler ¶
func (s *WSServer) AddEventHandler(h WSServerEventHandler)
func (*WSServer) GetClientsByType ¶
func (*WSServer) SendWSMessageTo ¶
Source Files
¶
- auth.go
- basic.go
- client.go
- keystone.go
- noauth.go
- server.go
- wsclient.go
- wsserver.go
Click to show internal directories.
Click to hide internal directories.