Versions in this module Expand all Collapse all v2 v2.2.0 Apr 29, 2026 Changes in this version + var RerrClientClosed = tp.NewRerror(100, "client is closed", "") + var RerrInternalServerError = tp.NewRerror(tp.CodeInternalServerError, "System is busy, please try again later", "") + var RerrInvalidParameter = tp.NewRerror(tp.CodeBadPacket, "Invalid Parameter", "") + var RerrNotFound = tp.NewRerror(tp.CodeNotFound, "Not Found", "") + var RerrNotOnline = tp.NewRerror(tp.CodeNotFound, "Not Found", "User is not online") + var RerrRenderFailed = tp.NewRerror(tp.CodeInternalServerError, "Template Rendering Failed", "") + func InnerIpPort(port string) (string, error) + func OuterIpPort(port string) (string, error) + type CircuitBreakerConfig struct + BreakDuration time.Duration + Enable bool + ErrorPercentage int + type CliConfig struct + CircuitBreaker CircuitBreakerConfig + CountTime bool + DefaultBodyCodec string + DefaultContextAge time.Duration + DefaultDialTimeout time.Duration + DefaultSessionAge time.Duration + Failover int + HeartbeatSecond int + LocalIP string + Network string + PrintDetail bool + SlowCometDuration time.Duration + TlsCertFile string + TlsKeyFile string + func (c *CliConfig) Check() error + func (c *CliConfig) Reload(bind cfgo.BindFunc) error + type Client struct + func NewClient(cfg CliConfig, linker Linker, globalLeftPlugin ...tp.Plugin) *Client + func (c *Client) AsyncPull(uri string, arg interface{}, result interface{}, pullCmdChan chan<- tp.PullCmd, ...) tp.PullCmd + func (c *Client) Close() + func (c *Client) Peer() tp.Peer + func (c *Client) PluginContainer() *tp.PluginContainer + func (c *Client) Pull(uri string, arg interface{}, result interface{}, ...) tp.PullCmd + func (c *Client) Push(uri string, arg interface{}, setting ...socket.PacketSetting) *tp.Rerror + func (c *Client) RoutePush(ctrlStruct interface{}, plugin ...tp.Plugin) []string + func (c *Client) RoutePushFunc(pushHandleFunc interface{}, plugin ...tp.Plugin) string + func (c *Client) SetProtoFunc(protoFunc socket.ProtoFunc) + func (c *Client) SubRoute(pathPrefix string, plugin ...tp.Plugin) *tp.SubRouter + func (c *Client) UsePullHeartbeat() + func (c *Client) UsePushHeartbeat() + type Linker interface + Close func() + Len func(uriPath string) int + Select func(uriPath string, exclude map[string]struct{}) (addr string, rerr *tp.Rerror) + WatchOffline func() <-chan string + func NewStaticLinker(srvAddr string) Linker + type Server struct + func NewServer(cfg SrvConfig, globalLeftPlugin ...tp.Plugin) *Server + func (s *Server) Close() error + func (s *Server) CountSession() int + func (s *Server) GetSession(sessionId string) (tp.Session, bool) + func (s *Server) ListenAndServe(protoFunc ...socket.ProtoFunc) error + func (s *Server) Peer() tp.Peer + func (s *Server) PluginContainer() *tp.PluginContainer + func (s *Server) RangeSession(fn func(sess tp.Session) bool) + func (s *Server) RoutePull(ctrlStruct interface{}, plugin ...tp.Plugin) []string + func (s *Server) RoutePullFunc(pullHandleFunc interface{}, plugin ...tp.Plugin) string + func (s *Server) RoutePush(ctrlStruct interface{}, plugin ...tp.Plugin) []string + func (s *Server) RoutePushFunc(pushHandleFunc interface{}, plugin ...tp.Plugin) string + func (s *Server) Router() *tp.Router + func (s *Server) ServeConn(conn net.Conn, protoFunc ...socket.ProtoFunc) (tp.Session, error) + func (s *Server) SetBindErrorFunc(fn binder.ErrorFunc) + func (s *Server) SetUnknownPull(fn func(tp.UnknownPullCtx) (interface{}, *tp.Rerror), plugin ...tp.Plugin) + func (s *Server) SetUnknownPush(fn func(tp.UnknownPushCtx) *tp.Rerror, plugin ...tp.Plugin) + func (s *Server) SubRoute(pathPrefix string, plugin ...tp.Plugin) *tp.SubRouter + type SrvConfig struct + CountTime bool + DefaultBodyCodec string + DefaultContextAge time.Duration + DefaultSessionAge time.Duration + EnableHeartbeat bool + ListenAddress string + Network string + OuterHost string + PrintDetail bool + SlowCometDuration time.Duration + TlsCertFile string + TlsKeyFile string + func (s *SrvConfig) InnerIpPort() string + func (s *SrvConfig) ListenPort() string + func (s *SrvConfig) OuterIpPort() string + func (s *SrvConfig) Reload(bind cfgo.BindFunc) error Other modules containing this package github.com/xiaoenai/tp-micro github.com/xiaoenai/tp-micro/v6