Documentation
¶
Index ¶
- Constants
- func AppName() string
- func Assert(cond bool, format string, a ...interface{})
- func AssertImposible(cond bool, format string, a ...interface{})
- func CrashSnap(err interface{})
- func GetCurrentPath() string
- func GetWorkPath() string
- func GoID() uint64
- func IsFileIsExist(filename string) bool
- func IsFullPath(path string) bool
- func JsonSubObjString(s, key string) string
- func LoadJson(file string) (*JSONRead, JSONS)
- func Log(a ...interface{})
- func LogAdd(id int, file string)
- func LogShutdown()
- func LogStartup(config string)
- func Logf(f string, a ...interface{})
- func Logfi(id int, f string, a ...interface{})
- func Logi(id int, a ...interface{})
- func NewJSON() map[string]interface{}
- func PathCheckEndChar(path string, add bool) (string, bool)
- func SendPackAndRecv(sock net.Conn, headertemp []byte, pack []byte) ([]byte, error)
- func SetAppName(n string)
- func SetWorkPath(s string)
- type ARACrpt
- type AutoConnFunc
- type ClientMeta
- type EVENT_SRC_ID
- type HttpFunc
- type HttpMux
- type IAutoConnHandler
- type IAutoConnInterface
- type IAutoConnInterfacePre
- type IAutoConnInterfaceWithId
- type IAutoConnect
- type IClient
- type IClientInterface
- type IClientInterfacePre
- type IClientInterfaceWithId
- type IDef
- type IHttp
- type IHttpHandler
- type IHttpInterface
- type IHttpServer
- type INI
- func (p INI) Int(s, k string) int
- func (p INI) Is(s, k string) bool
- func (p INI) Sec(s string) map[string]string
- func (p *INI) SetDefBool(i bool) bool
- func (p *INI) SetDefFloat(i float64) float64
- func (p *INI) SetDefInt(i int64) int64
- func (p *INI) SetDefString(i string) string
- func (p INI) Str(s, k string) string
- type INIT
- type INewConnInterface
- type IPool
- type IQueueItemCtrl
- type IRegisterInterface
- type IRequest
- type IRequestComm
- type IRequestData
- type IResponse
- type IRun
- type IRunCtrl1
- type IRunCtrl2
- type IServer
- type ISocket
- type IStop
- type ITick
- type JSONRead
- func (p *JSONRead) Num(s string, x ...interface{}) int64
- func (p *JSONRead) NumF64(s string, x ...interface{}) float64
- func (p *JSONRead) SetDefBool(i bool) bool
- func (p *JSONRead) SetDefFloat(i float64) float64
- func (p *JSONRead) SetDefInt(i int64) int64
- func (p *JSONRead) SetDefString(i string) string
- func (p *JSONRead) Size(s string, x ...interface{}) uint64
- func (p *JSONRead) Sss(s string, x ...interface{}) string
- type JSONS
- type JSONT
- type ServiceConfig
- type TickFunc
- type XY
Constants ¶
View Source
const LOG_DEF int = 0
View Source
const LOG_HTTP = -419
View Source
const LOG_KERL int = -417
View Source
const LONG_TIME_FUNC = time.Duration(100) * time.Millisecond
View Source
const PACKAGE_FLAG_CONFIG = "@VIOXYCFG:" //规定设置数据格式 headerxyid,ip,dataformat-
View Source
const XY_CONFIG = 30003
View Source
const XY_REGISTER = 30001
View Source
const XY_REGISTER_RSP = 30002
Variables ¶
This section is empty.
Functions ¶
func AssertImposible ¶
func GetCurrentPath ¶
func GetCurrentPath() string
func GetWorkPath ¶
func GetWorkPath() string
func IsFileIsExist ¶
func IsFullPath ¶
func JsonSubObjString ¶
func LogShutdown ¶
func LogShutdown()
func LogStartup ¶
func LogStartup(config string)
func SendPackAndRecv ¶
func SetAppName ¶
func SetAppName(n string)
func SetWorkPath ¶
func SetWorkPath(s string)
Types ¶
type ARACrpt ¶
type ARACrpt struct {
// contains filtered or unexported fields
}
func (*ARACrpt) TransformChar ¶
func (*ARACrpt) TransformString ¶
type AutoConnFunc ¶
func (AutoConnFunc) OnPackage ¶
func (f AutoConnFunc) OnPackage(data []byte, xy XY)
type ClientMeta ¶
type ClientMeta struct { VerCode int32 //客户端版本 AppID string //客户端APPKEY DeviceID string ////客户端设备特征码 }
FishClientMeta 客户端信息
type EVENT_SRC_ID ¶
type EVENT_SRC_ID string
type HttpFunc ¶
func (HttpFunc) OnHttpRequest ¶
type HttpMux ¶
type HttpMux struct {
// contains filtered or unexported fields
}
func NewHttpMux ¶
func NewHttpMux() *HttpMux
func (*HttpMux) Handle ¶
func (p *HttpMux) Handle(pattern string, handler IHttpHandler)
type IAutoConnHandler ¶
type IAutoConnInterface ¶
type IAutoConnInterfacePre ¶
type IAutoConnInterfacePre interface { OnReady(id int, ctrl IQueueItemCtrl) OnPackage(data []byte, xy XY, ctrl IQueueItemCtrl) OnClose(ctrl IQueueItemCtrl) }
type IAutoConnInterfaceWithId ¶
type IAutoConnInterfaceWithId interface { OnAutoConnReady(iid EVENT_SRC_ID, id int) OnAutoConnPackage(iid EVENT_SRC_ID, data []byte, xy XY) OnAutoConnClose(iid EVENT_SRC_ID) }
type IAutoConnect ¶
func AutoConnect ¶
func AutoConnect(n string, addrs string, auth string, svrType int, serviceid int, cbAutoConn IAutoConnInterface) IAutoConnect
type IClient ¶
type IClient interface { Ip() string SetSilent() //设置成静默,将永远不能再接收数据 BreakConnect() //中断连接 SetUserData(k string, d interface{}) //设置数据,需要自行处理数据安全问题 UserData(k string, def interface{}) interface{} //得到数据,需要自行处理数据安全问题 UserDataNum(k string, def int64) int64 //得到数据,需要自行处理数据安全问题 UserDataSss(k string, def string) string //得到数据,需要自行处理数据安全问题 CloseCause() int //关闭原因 SendXY(xy XY, pack []byte) int SendPackage(pack []byte) int }
type IClientInterface ¶
type IClientInterfacePre ¶
type IClientInterfacePre interface { OnClientPackage(c IClient, data []byte, xy XY, ctrl IQueueItemCtrl) OnClientClose(c IClient, ctrl IQueueItemCtrl) }
type IClientInterfaceWithId ¶
type IClientInterfaceWithId interface { OnClientPackage(iid EVENT_SRC_ID, c IClient, data []byte, xy XY) OnClientClose(iid EVENT_SRC_ID, c IClient) }
type IHttpHandler ¶
type IHttpInterface ¶
type IHttpServer ¶
func ServeHttp ¶
func ServeHttp(addr string, handler *HttpMux) IHttpServer
func ServeHttpAll ¶
func ServeHttpAll(addr string, handler *HttpMux, cbConn INewConnInterface, cbIf IClientInterface, cbReg IRegisterInterface) IHttpServer
type INI ¶
type INI struct { INIT // contains filtered or unexported fields }
func (*INI) SetDefBool ¶
func (*INI) SetDefFloat ¶
func (*INI) SetDefString ¶
type INewConnInterface ¶
type INewConnInterface interface {
OnNewClientConnect(c IClient)
}
type IPool ¶
type IPool interface { Get() interface{} Put(a interface{}) }
func NewHttpPool ¶
func NewSocketPool ¶
type IQueueItemCtrl ¶
type IQueueItemCtrl interface {
Drop()
}
type IRegisterInterface ¶
type IRequestComm ¶
type IRequestComm = *ClientMeta
type IRunCtrl1 ¶
func NewAsyncMultiRun ¶
type IRunCtrl2 ¶
type IRunCtrl2 interface { IRunCtrl1 SetupAutoConnInterface(iid EVENT_SRC_ID, prevIf IAutoConnInterfacePre) IAutoConnInterface SetupClientInterface(iid EVENT_SRC_ID, prevIf IClientInterfacePre) IClientInterface }
func NewQueueRun ¶
func NewQueueRun(n string, spanMs uint32, cbTick ITick, cbClientIf IClientInterfaceWithId, cbAutoConn IAutoConnInterfaceWithId) IRunCtrl2
type IServer ¶
func ServeStartup ¶
func ServeStartup(addr string, cbConn INewConnInterface, cbIf IClientInterface) IServer
func ServeStartupAll ¶
func ServeStartupAll(addr string, cbConn INewConnInterface, cbIf IClientInterface, cbCheck IRegisterInterface) IServer
type ISocket ¶
type ISocket interface { SendPackage(xy XY, pack []byte) error ReadPackage(rxy ...XY) (XY, []byte, error) Request(xy XY, pack []byte, rxy ...XY) (XY, []byte, error) JSONSendPackage(xy XY, json map[string]interface{}) error JSONReadPackage(rxy ...XY) (XY, map[string]interface{}, error) JSONRequest(xy XY, json map[string]interface{}, rxy ...XY) (XY, map[string]interface{}, error) }
ISocket 无状态连接 注:同步的
type JSONRead ¶
type JSONRead struct { JSONT // contains filtered or unexported fields }
func NewJSONRead ¶
func (*JSONRead) SetDefBool ¶
func (*JSONRead) SetDefFloat ¶
func (*JSONRead) SetDefString ¶
type ServiceConfig ¶
type ServiceConfig struct { }
func (*ServiceConfig) AddClientHander ¶
func (p *ServiceConfig) AddClientHander(cmd int16)
func (*ServiceConfig) AddHander ¶
func (p *ServiceConfig) AddHander(id int)
func (*ServiceConfig) AddHttpHander ¶
func (p *ServiceConfig) AddHttpHander(file string)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.