server

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const REGISTRY_RETRY_INTERVAL = 3000

Variables

This section is empty.

Functions

func GetHostname

func GetHostname() (string, error)

Types

type Http

type Http struct {
	Hostname string
	Port     int
}

func (*Http) NewServer

func (p *Http) NewServer() Server

type HttpOptions

type HttpOptions struct {
}

type HttpServer

type HttpServer struct {
	Hostname  string
	Port      int
	Server    common.Server
	Options   HttpOptions
	Event     chan int
	Discovery discovery.Driver
}

func (*HttpServer) DiscoveryRegister

func (s *HttpServer) DiscoveryRegister(key, value interface{}) bool

func (*HttpServer) GetEvent

func (s *HttpServer) GetEvent() <-chan int

func (*HttpServer) Register

func (s *HttpServer) Register(m any)

func (*HttpServer) RegisterWithName added in v0.0.5

func (s *HttpServer) RegisterWithName(m any, name string)

func (*HttpServer) SetAfterFunc

func (s *HttpServer) SetAfterFunc(afterFunc func(id any, method string, result any) error)

func (*HttpServer) SetBeforeFunc

func (s *HttpServer) SetBeforeFunc(beforeFunc func(id any, method string, params any) error)

func (*HttpServer) SetDiscovery

func (s *HttpServer) SetDiscovery(d discovery.Driver, hostname string)

func (*HttpServer) SetOptions

func (s *HttpServer) SetOptions(httpOptions any)

func (*HttpServer) SetRateLimit

func (s *HttpServer) SetRateLimit(r rate.Limit, b int)

func (*HttpServer) Start

func (s *HttpServer) Start() error

type Protocol

type Protocol interface {
	NewServer() Server
}

type Server

type Server interface {
	SetBeforeFunc(func(id any, method string, params any) error)
	SetAfterFunc(func(id any, method string, result any) error)
	SetOptions(any)
	SetDiscovery(d discovery.Driver, hostname string)
	SetRateLimit(rate.Limit, int)
	Start() error
	Register(s any)
	RegisterWithName(s any, name string)
	DiscoveryRegister(key, value interface{}) bool
	GetEvent() <-chan int
}

func NewServer

func NewServer[T Protocol](p T) Server

type Tcp

type Tcp struct {
	Hostname string
	Port     int
}

func (*Tcp) NewServer

func (p *Tcp) NewServer() Server

type TcpOptions

type TcpOptions struct {
	ReqCheckEof  string
	RespAddEof   string
	ReqMaxLength int64
}

type TcpServer

type TcpServer struct {
	Hostname  string
	Port      int
	Server    common.Server
	Options   TcpOptions
	Event     chan int
	Discovery discovery.Driver
}

func (*TcpServer) DiscoveryRegister

func (s *TcpServer) DiscoveryRegister(key, value interface{}) bool

func (*TcpServer) GetEvent

func (s *TcpServer) GetEvent() <-chan int

func (*TcpServer) Register

func (s *TcpServer) Register(m any)

func (*TcpServer) RegisterWithName added in v0.0.5

func (s *TcpServer) RegisterWithName(m any, name string)

func (*TcpServer) SetAfterFunc

func (s *TcpServer) SetAfterFunc(afterFunc func(id any, method string, result any) error)

func (*TcpServer) SetBeforeFunc

func (s *TcpServer) SetBeforeFunc(beforeFunc func(id any, method string, params any) error)

func (*TcpServer) SetDiscovery

func (s *TcpServer) SetDiscovery(d discovery.Driver, hostname string)

func (*TcpServer) SetOptions

func (s *TcpServer) SetOptions(tcpOptions any)

func (*TcpServer) SetRateLimit

func (s *TcpServer) SetRateLimit(r rate.Limit, b int)

func (*TcpServer) Start

func (s *TcpServer) Start() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL