Documentation ¶
Index ¶
- func InitReload(cPath string, fParseAndRun func([]string) error) error
- type CmdlineConfigUnix
- type ConnectCommand
- type ConnectCommandType
- type ControlCommand
- type ControlCommandType
- type ControlFuncOperations
- type Copier
- type Net
- type NetceptorForControlCommand
- type NetceptorForControlsvc
- type Neter
- type PingCommand
- type PingCommandType
- type ReloadCommand
- type ReloadCommandType
- type Server
- func (s *Server) AddControlFunc(name string, cType ControlCommandType) error
- func (s *Server) ConnectionListener(ctx context.Context, listener net.Listener)
- func (s *Server) RunControlSession(conn net.Conn)
- func (s *Server) RunControlSvc(ctx context.Context, service string, tlscfg *tls.Config, unixSocket string, ...) error
- func (s *Server) SetServerNet(n Neter)
- func (s *Server) SetServerTLS(t Tlser)
- func (s *Server) SetServerUtils(u Utiler)
- func (s *Server) SetupConnection(conn net.Conn)
- type SockControl
- func (s *SockControl) BridgeConn(message string, bc io.ReadWriteCloser, bcName string, ...) error
- func (s *SockControl) Close() error
- func (s *SockControl) ReadFromConn(message string, out io.Writer, io Copier) error
- func (s *SockControl) RemoteAddr() net.Addr
- func (s *SockControl) WriteMessage(message string) error
- func (s *SockControl) WriteToConn(message string, in chan []byte) error
- type SocketConnIO
- type StatusCommand
- type StatusCommandType
- type TLS
- type Tlser
- type TracerouteCommand
- type TracerouteCommandType
- type Util
- type Utiler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CmdlineConfigUnix ¶ added in v1.4.9
type CmdlineConfigUnix struct { Service string `description:"Receptor service name to listen on" default:"control"` Filename string `description:"Specifies the filename of a local Unix socket to bind to the service."` Permissions int `description:"Socket file permissions" default:"0600"` TLS string `description:"Name of TLS server config for the Receptor listener"` TCPListen string `description:"Local TCP port or host:port to bind to the control service"` TCPTLS string `description:"Name of TLS server config for the TCP listener"` }
cmdlineConfigUnix is the cmdline configuration object for a control service on Unix.
func (CmdlineConfigUnix) Run ¶ added in v1.4.9
func (cfg CmdlineConfigUnix) Run() error
Run runs the action.
type ConnectCommand ¶ added in v1.4.2
type ConnectCommand struct {
// contains filtered or unexported fields
}
func (*ConnectCommand) ControlFunc ¶ added in v1.4.2
func (c *ConnectCommand) ControlFunc(_ context.Context, nc NetceptorForControlCommand, cfo ControlFuncOperations) (map[string]interface{}, error)
type ConnectCommandType ¶ added in v1.4.2
type ConnectCommandType struct{}
func (*ConnectCommandType) InitFromJSON ¶ added in v1.4.2
func (t *ConnectCommandType) InitFromJSON(config map[string]interface{}) (ControlCommand, error)
func (*ConnectCommandType) InitFromString ¶ added in v1.4.2
func (t *ConnectCommandType) InitFromString(params string) (ControlCommand, error)
type ControlCommand ¶
type ControlCommand interface {
ControlFunc(context.Context, NetceptorForControlCommand, ControlFuncOperations) (map[string]interface{}, error)
}
ControlCommand is an instance of a command that is being run from the control service.
type ControlCommandType ¶
type ControlCommandType interface { InitFromString(string) (ControlCommand, error) InitFromJSON(map[string]interface{}) (ControlCommand, error) }
ControlCommandType is a type of command that can be run from the control service.
type ControlFuncOperations ¶
type ControlFuncOperations interface { BridgeConn(message string, bc io.ReadWriteCloser, bcName string, logger *logger.ReceptorLogger, utils Utiler) error ReadFromConn(message string, out io.Writer, io Copier) error WriteToConn(message string, in chan []byte) error Close() error RemoteAddr() net.Addr }
ControlFuncOperations provides callbacks for control services to take actions.
type NetceptorForControlCommand ¶ added in v1.4.2
type NetceptorForControlCommand interface { GetClientTLSConfig(name string, expectedHostName string, expectedHostNameType netceptor.ExpectedHostnameType) (*tls.Config, error) Dial(node string, service string, tlscfg *tls.Config) (*netceptor.Conn, error) Ping(ctx context.Context, target string, hopsToLive byte) (time.Duration, string, error) MaxForwardingHops() byte Status() netceptor.Status Traceroute(ctx context.Context, target string) <-chan *netceptor.TracerouteResult NodeID() string GetLogger() *logger.ReceptorLogger CancelBackends() }
type NetceptorForControlsvc ¶ added in v1.4.2
type PingCommand ¶ added in v1.4.2
type PingCommand struct {
// contains filtered or unexported fields
}
func (*PingCommand) ControlFunc ¶ added in v1.4.2
func (c *PingCommand) ControlFunc(ctx context.Context, nc NetceptorForControlCommand, _ ControlFuncOperations) (map[string]interface{}, error)
type PingCommandType ¶ added in v1.4.2
type PingCommandType struct{}
func (*PingCommandType) InitFromJSON ¶ added in v1.4.2
func (t *PingCommandType) InitFromJSON(config map[string]interface{}) (ControlCommand, error)
func (*PingCommandType) InitFromString ¶ added in v1.4.2
func (t *PingCommandType) InitFromString(params string) (ControlCommand, error)
type ReloadCommand ¶ added in v1.4.2
type ReloadCommand struct{}
func (*ReloadCommand) ControlFunc ¶ added in v1.4.2
func (c *ReloadCommand) ControlFunc(_ context.Context, nc NetceptorForControlCommand, _ ControlFuncOperations) (map[string]interface{}, error)
type ReloadCommandType ¶ added in v1.4.2
type ReloadCommandType struct{}
func (*ReloadCommandType) InitFromJSON ¶ added in v1.4.2
func (t *ReloadCommandType) InitFromJSON(_ map[string]interface{}) (ControlCommand, error)
func (*ReloadCommandType) InitFromString ¶ added in v1.4.2
func (t *ReloadCommandType) InitFromString(_ string) (ControlCommand, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an instance of a control service.
var MainInstance *Server
MainInstance is the global instance of the control service instantiated by the command-line main() function.
func New ¶
func New(stdServices bool, nc NetceptorForControlsvc) *Server
New returns a new instance of a control service.
func (*Server) AddControlFunc ¶
func (s *Server) AddControlFunc(name string, cType ControlCommandType) error
AddControlFunc registers a function that can be used from a control socket.
func (*Server) ConnectionListener ¶ added in v1.4.2
func (*Server) RunControlSession ¶
RunControlSession runs the server protocol on the given connection.
func (*Server) RunControlSvc ¶
func (s *Server) RunControlSvc(ctx context.Context, service string, tlscfg *tls.Config, unixSocket string, unixSocketPermissions os.FileMode, tcpListen string, tcptls *tls.Config, ) error
RunControlSvc runs the main accept loop of the control service.
func (*Server) SetServerNet ¶ added in v1.4.2
func (*Server) SetServerTLS ¶ added in v1.4.2
func (*Server) SetServerUtils ¶ added in v1.4.2
func (*Server) SetupConnection ¶ added in v1.4.2
type SockControl ¶ added in v1.4.2
type SockControl struct {
// contains filtered or unexported fields
}
SockControl implements the ControlFuncOperations interface that is passed back to control functions.
func NewSockControl ¶ added in v1.4.2
func NewSockControl(conn net.Conn) *SockControl
func (*SockControl) BridgeConn ¶ added in v1.4.2
func (s *SockControl) BridgeConn(message string, bc io.ReadWriteCloser, bcName string, logger *logger.ReceptorLogger, utils Utiler) error
BridgeConn bridges the socket to another socket.
func (*SockControl) Close ¶ added in v1.4.2
func (s *SockControl) Close() error
func (*SockControl) ReadFromConn ¶ added in v1.4.2
ReadFromConn copies from the socket to an io.Writer, until EOF.
func (*SockControl) RemoteAddr ¶ added in v1.4.2
func (s *SockControl) RemoteAddr() net.Addr
func (*SockControl) WriteMessage ¶ added in v1.4.2
func (s *SockControl) WriteMessage(message string) error
WriteMessage attempts to write a message to a connection.
func (*SockControl) WriteToConn ¶ added in v1.4.2
func (s *SockControl) WriteToConn(message string, in chan []byte) error
WriteToConn writes an initial string, and then messages to a channel, to the connection.
type SocketConnIO ¶ added in v1.4.2
type SocketConnIO struct{}
type StatusCommand ¶ added in v1.4.2
type StatusCommand struct {
// contains filtered or unexported fields
}
func (*StatusCommand) ControlFunc ¶ added in v1.4.2
func (c *StatusCommand) ControlFunc(_ context.Context, nc NetceptorForControlCommand, _ ControlFuncOperations) (map[string]interface{}, error)
type StatusCommandType ¶ added in v1.4.2
type StatusCommandType struct{}
func (*StatusCommandType) InitFromJSON ¶ added in v1.4.2
func (t *StatusCommandType) InitFromJSON(config map[string]interface{}) (ControlCommand, error)
func (*StatusCommandType) InitFromString ¶ added in v1.4.2
func (t *StatusCommandType) InitFromString(params string) (ControlCommand, error)
type TracerouteCommand ¶ added in v1.4.2
type TracerouteCommand struct {
// contains filtered or unexported fields
}
func (*TracerouteCommand) ControlFunc ¶ added in v1.4.2
func (c *TracerouteCommand) ControlFunc(ctx context.Context, nc NetceptorForControlCommand, _ ControlFuncOperations) (map[string]interface{}, error)
type TracerouteCommandType ¶ added in v1.4.2
type TracerouteCommandType struct{}
func (*TracerouteCommandType) InitFromJSON ¶ added in v1.4.2
func (t *TracerouteCommandType) InitFromJSON(config map[string]interface{}) (ControlCommand, error)
func (*TracerouteCommandType) InitFromString ¶ added in v1.4.2
func (t *TracerouteCommandType) InitFromString(params string) (ControlCommand, error)
type Util ¶ added in v1.4.2
type Util struct{}
func (*Util) BridgeConns ¶ added in v1.4.2
func (u *Util) BridgeConns(c1 io.ReadWriteCloser, c1Name string, c2 io.ReadWriteCloser, c2Name string, logger *logger.ReceptorLogger)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_controlsvc is a generated GoMock package.
|
Package mock_controlsvc is a generated GoMock package. |