Documentation
¶
Index ¶
- Constants
- Variables
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func Exists(file string) bool
- func GetEnv() string
- func GetFreePort() (int, error)
- func GetFunctionName(i interface{}) string
- func GetMimeType(fileName string) (mimeType string)
- func NewSimpleConfig(file string, obj interface{}) error
- func ReadFile(file string, obj interface{}) ([]byte, error)
- func ReadFileLines(file string) ([]string, error)
- func StatusText(code Status) string
- func WriteFile(file string, obj interface{}) error
- type AppClientConfig
- type AppClientManagerConfig
- type AppServerConfig
- type AppServerManagerConfig
- type Base
- type Client
- func (c *Client) Invoke(method, address string, headers Headers, body ...[]byte) (*Response, error)
- func (c *Client) NewRequest(method string, address string, headers ...Headers) *Request
- func (c *Client) NewResponse(method string, address string, conn net.Conn) (*Response, error)
- func (c *Client) Reconfigure(options ...ClientOption)
- func (c *Client) Send(request *Request) (*Response, error)
- type ClientConfig
- type ClientManager
- type ClientManagerConfig
- type ClientManagerOption
- type ClientOption
- type ClientService
- type Clients
- type Context
- type ErrorHandler
- type HandlerFunc
- type Headers
- type Log
- type Method
- type Methods
- type MiddlewareFunc
- type Request
- type RequestHandler
- type Response
- type Server
- func (w *Server) AddMethod(method string, handler HandlerFunc, middleware ...MiddlewareFunc)
- func (w *Server) AddMethods(methods ...*Method) error
- func (w *Server) AddMiddlewares(middlewares ...MiddlewareFunc)
- func (w *Server) DefaultErrorHandler(ctx *Context, err error) error
- func (w *Server) GetMethod(method string) (*Method, error)
- func (w *Server) Implement(implementation interface{}, middleware ...MiddlewareFunc)
- func (w *Server) NewRequest(conn net.Conn, server *Server) (*Request, error)
- func (w *Server) NewResponse(request *Request) *Response
- func (w *Server) Reconfigure(options ...ServerOption)
- func (w *Server) SetErrorHandler(handler ErrorHandler) error
- func (w *Server) Start(waitGroup ...*sync.WaitGroup) error
- func (w *Server) Started() bool
- func (w *Server) Stop(waitGroup ...*sync.WaitGroup) error
- type ServerConfig
- type ServerManager
- func (w *ServerManager) Reconfigure(options ...ServerManagerOption)
- func (sm *ServerManager) Register(server *Server) *ServerManager
- func (sm *ServerManager) Start(waitGroup ...*sync.WaitGroup) error
- func (sm *ServerManager) Started() bool
- func (sm *ServerManager) Stop(waitGroup ...*sync.WaitGroup) error
- type ServerManagerConfig
- type ServerManagerOption
- type ServerOption
- type ServerService
- type Servers
- type Status
Constants ¶
View Source
const ( HeaderTimeFormat = time.RFC3339 TimeFormat = time.RFC3339 )
View Source
const ( // Headers HeaderServer = "Server" HeaderDate = "Date" HeaderHost = "Host" HeaderUserAgent = "User-Agent" )
Variables ¶
Functions ¶
func GetFreePort ¶
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
func GetMimeType ¶
func NewSimpleConfig ¶
func ReadFileLines ¶
func StatusText ¶
Types ¶
type AppClientConfig ¶
type AppClientConfig struct {
Client ClientConfig `json:"client"`
}
func NewClientConfig ¶
func NewClientConfig() (*AppClientConfig, error)
type AppClientManagerConfig ¶
type AppClientManagerConfig struct {
ClientManager ClientManagerConfig `json:"client_manager"`
}
func NewClientManagerConfig ¶
func NewClientManagerConfig() (*AppClientManagerConfig, error)
type AppServerConfig ¶
type AppServerConfig struct {
Server ServerConfig `json:"server"`
}
func NewServerConfig ¶
func NewServerConfig() (*AppServerConfig, error)
type AppServerManagerConfig ¶
type AppServerManagerConfig struct {
ServerManager ServerManagerConfig `json:"server_manager"`
}
func NewServerManagerConfig ¶
func NewServerManagerConfig() (*AppServerManagerConfig, error)
type Base ¶
type Base struct { IP string Address string Method string Headers Headers Server *Server Client *Client // contains filtered or unexported fields }
func (*Base) BindHeaders ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
func (*Client) NewRequest ¶
func (*Client) NewResponse ¶
type ClientConfig ¶
type ClientConfig struct {
Log Log `json:"log"`
}
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
func NewClientManager ¶
func NewClientManager(options ...ClientManagerOption) (*ClientManager, error)
func (*ClientManager) Reconfigure ¶
func (c *ClientManager) Reconfigure(options ...ClientManagerOption)
Reconfigure ...
type ClientManagerConfig ¶
type ClientManagerConfig struct { Servers map[string]*ClientService `json:"Servers"` Log Log `json:"log"` }
type ClientManagerOption ¶
type ClientManagerOption func(ClientManager *ClientManager)
ClientManagerOption ...
func WithClientManagerConfiguration ¶
func WithClientManagerConfiguration(config *ClientManagerConfig) ClientManagerOption
WithClientManagerConfiguration ...
func WithClientManagerLogLevel ¶
func WithClientManagerLogLevel(level logger.Level) ClientManagerOption
WithClientManagerLogLevel ...
func WithClientManagerLogger ¶
func WithClientManagerLogger(logger logger.ILogger) ClientManagerOption
WithClientManagerLogger ...
type ClientOption ¶
type ClientOption func(client *Client)
ClientOption ...
func WithClientConfiguration ¶
func WithClientConfiguration(config *ClientConfig) ClientOption
WithClientConfiguration ...
func WithClientLogLevel ¶
func WithClientLogLevel(level logger.Level) ClientOption
WithClientLogLevel ...
func WithClientLogger ¶
func WithClientLogger(logger logger.ILogger) ClientOption
WithClientLogger ...
type ClientService ¶
type ClientService struct {
Address string `json:"address"`
}
type Context ¶
func NewContext ¶
type ErrorHandler ¶
type HandlerFunc ¶
type Method ¶
type Method struct { Name string Method string Handler HandlerFunc Middlewares []MiddlewareFunc }
func NewMethod ¶
func NewMethod(method string, handler HandlerFunc, middleware ...MiddlewareFunc) *Method
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
type RequestHandler ¶
type RequestHandler struct { Conn net.Conn Handler HandlerFunc }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(options ...ServerOption) (*Server, error)
func (*Server) AddMethod ¶
func (w *Server) AddMethod(method string, handler HandlerFunc, middleware ...MiddlewareFunc)
func (*Server) AddMethods ¶
func (*Server) AddMiddlewares ¶
func (w *Server) AddMiddlewares(middlewares ...MiddlewareFunc)
func (*Server) DefaultErrorHandler ¶
func (*Server) Implement ¶
func (w *Server) Implement(implementation interface{}, middleware ...MiddlewareFunc)
func (*Server) NewRequest ¶
func (*Server) NewResponse ¶
func (*Server) SetErrorHandler ¶
func (w *Server) SetErrorHandler(handler ErrorHandler) error
type ServerConfig ¶
type ServerManager ¶
type ServerManager struct {
// contains filtered or unexported fields
}
func NewServerManager ¶
func NewServerManager(options ...ServerManagerOption) (*ServerManager, error)
func (*ServerManager) Reconfigure ¶
func (w *ServerManager) Reconfigure(options ...ServerManagerOption)
Reconfigure ...
func (*ServerManager) Register ¶
func (sm *ServerManager) Register(server *Server) *ServerManager
func (*ServerManager) Started ¶
func (sm *ServerManager) Started() bool
type ServerManagerConfig ¶
type ServerManagerConfig struct { Servers map[string]*ServerService `json:"Servers"` Log Log `json:"log"` }
type ServerManagerOption ¶
type ServerManagerOption func(ServerManager *ServerManager)
ServerManagerOption ...
func WithServerManagerConfiguration ¶
func WithServerManagerConfiguration(config *ServerManagerConfig) ServerManagerOption
WithServerManagerConfiguration ...
func WithServerManagerLogLevel ¶
func WithServerManagerLogLevel(level logger.Level) ServerManagerOption
WithServerManagerLogLevel ...
func WithServerManagerLogger ¶
func WithServerManagerLogger(logger logger.ILogger) ServerManagerOption
WithServerManagerLogger ...
type ServerOption ¶
type ServerOption func(server *Server)
ServerOption ...
func WithServerConfiguration ¶
func WithServerConfiguration(config *ServerConfig) ServerOption
WithServerConfiguration ...
func WithServerLogLevel ¶
func WithServerLogLevel(level logger.Level) ServerOption
WithServerLogLevel ...
func WithServerLogger ¶
func WithServerLogger(logger logger.ILogger) ServerOption
WithServerLogger ...
type ServerService ¶
type ServerService struct {
Address string `json:"address"`
}
Source Files
¶
- base.go
- client.go
- client_config.go
- client_manager.go
- client_manager_config.go
- client_manager_options.go
- client_options.go
- client_request.go
- client_response.go
- config.go
- consts.go
- context.go
- errors.go
- headers.go
- request.go
- response.go
- server.go
- server_config.go
- server_context.go
- server_manager.go
- server_manager_config.go
- server_manager_options.go
- server_methods.go
- server_options.go
- server_request.go
- server_response.go
- status.go
- structs.go
- utils.go
Click to show internal directories.
Click to hide internal directories.