model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigPath = "config/agent/route_rule"
)

Variables

View Source
var (
	FrontendSessionManager peer.SessionManager
	AgentSvcID             string // 网关id
)

Functions

func AddRouteRule

func AddRouteRule(rule *RouteRule)

添加路由规则

func ClearRule

func ClearRule()

清除所有规则

func GetClientSession

func GetClientSession(sesid int64) cellnet.Session

func VisitUser

func VisitUser(callback func(*User) bool)

遍历所有的用户

Types

type Backend

type Backend struct {
	SvcName string
	Session cellnet.Session
}

type RouteRule

type RouteRule struct {
	MsgName string
	SvcName string
	Mode    string // auth: 需要授权 pass: 可通过
}

路由规则

func GetTargetService

func GetTargetService(msgName string) *RouteRule

消息名取路由规则

type RouteTable

type RouteTable struct {
	Rule []*RouteRule
}

路由表,包含多条路由规则

type User

type User struct {
	ClientSession cellnet.Session
	Targets       []*Backend
	LastPingTime  time.Time
}

func CreateUser

func CreateUser(clientSes cellnet.Session) *User

创建一个网关用户

func GetUser

func GetUser(sesid int64) *User

func NewUser

func NewUser(clientSes cellnet.Session) *User

func SessionToUser

func SessionToUser(clientSes cellnet.Session) *User

用session获取用户

func (*User) AddBackend

func (self *User) AddBackend(svcName string, ses cellnet.Session)

func (*User) GetBackend

func (self *User) GetBackend(svcName string) cellnet.Session

func (*User) SetBackend

func (self *User) SetBackend(svcName string, ses cellnet.Session)

Jump to

Keyboard shortcuts

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