proxy_tars

package
v0.0.0-...-2a177de Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BITS                 = 2048
	CMD_LOGOUT           = 1999
	CMD_HEART     uint32 = 101
	CONNECT_CLOSE int    = 1
)
View Source
const MODIFY_RESPONSE = "ModifyResponse_key"
View Source
const TIMEOUT = "tcp_timeout"

Variables

View Source
var ECmd_name = map[int32]string{
	0:   "UNKNOWN",
	601: "E_LOGIN_NOTIFY_REQ",
}
View Source
var ECmd_value = map[string]int32{
	"UNKNOWN":            0,
	"E_LOGIN_NOTIFY_REQ": 601,
}

Functions

func HandleQueue

func HandleQueue(b []byte)

func ModifyResponse

func ModifyResponse(rsp *http.Response) (err error)

Types

type ECmd

type ECmd int32
const (
	ECmd_UNKNOWN            ECmd = 0
	ECmd_E_LOGIN_NOTIFY_REQ ECmd = 601
)

func (ECmd) EnumDescriptor

func (ECmd) EnumDescriptor() ([]byte, []int)

func (ECmd) String

func (x ECmd) String() string

type ErrorRsp

type ErrorRsp struct {
	Errinfo              *Errorinfo `protobuf:"bytes,1,opt,name=errinfo,proto3" json:"errinfo,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*ErrorRsp) Descriptor

func (*ErrorRsp) Descriptor() ([]byte, []int)

func (*ErrorRsp) GetErrinfo

func (m *ErrorRsp) GetErrinfo() *Errorinfo

func (*ErrorRsp) ProtoMessage

func (*ErrorRsp) ProtoMessage()

func (*ErrorRsp) Reset

func (m *ErrorRsp) Reset()

func (*ErrorRsp) String

func (m *ErrorRsp) String() string

func (*ErrorRsp) XXX_DiscardUnknown

func (m *ErrorRsp) XXX_DiscardUnknown()

func (*ErrorRsp) XXX_Marshal

func (m *ErrorRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ErrorRsp) XXX_Merge

func (m *ErrorRsp) XXX_Merge(src proto.Message)

func (*ErrorRsp) XXX_Size

func (m *ErrorRsp) XXX_Size() int

func (*ErrorRsp) XXX_Unmarshal

func (m *ErrorRsp) XXX_Unmarshal(b []byte) error

type Errorinfo

type Errorinfo struct {
	ErrorCode            uint32   `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
	ErrorInfo            []byte   `protobuf:"bytes,2,opt,name=error_info,json=errorInfo,proto3" json:"error_info,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Errorinfo) Descriptor

func (*Errorinfo) Descriptor() ([]byte, []int)

func (*Errorinfo) GetErrorCode

func (m *Errorinfo) GetErrorCode() uint32

func (*Errorinfo) GetErrorInfo

func (m *Errorinfo) GetErrorInfo() []byte

func (*Errorinfo) ProtoMessage

func (*Errorinfo) ProtoMessage()

func (*Errorinfo) Reset

func (m *Errorinfo) Reset()

func (*Errorinfo) String

func (m *Errorinfo) String() string

func (*Errorinfo) XXX_DiscardUnknown

func (m *Errorinfo) XXX_DiscardUnknown()

func (*Errorinfo) XXX_Marshal

func (m *Errorinfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Errorinfo) XXX_Merge

func (m *Errorinfo) XXX_Merge(src proto.Message)

func (*Errorinfo) XXX_Size

func (m *Errorinfo) XXX_Size() int

func (*Errorinfo) XXX_Unmarshal

func (m *Errorinfo) XXX_Unmarshal(b []byte) error

type LoginNotifyReq

type LoginNotifyReq struct {
	Uid                  uint64   `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*LoginNotifyReq) Descriptor

func (*LoginNotifyReq) Descriptor() ([]byte, []int)

func (*LoginNotifyReq) GetUid

func (m *LoginNotifyReq) GetUid() uint64

func (*LoginNotifyReq) ProtoMessage

func (*LoginNotifyReq) ProtoMessage()

func (*LoginNotifyReq) Reset

func (m *LoginNotifyReq) Reset()

func (*LoginNotifyReq) String

func (m *LoginNotifyReq) String() string

func (*LoginNotifyReq) XXX_DiscardUnknown

func (m *LoginNotifyReq) XXX_DiscardUnknown()

func (*LoginNotifyReq) XXX_Marshal

func (m *LoginNotifyReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LoginNotifyReq) XXX_Merge

func (m *LoginNotifyReq) XXX_Merge(src proto.Message)

func (*LoginNotifyReq) XXX_Size

func (m *LoginNotifyReq) XXX_Size() int

func (*LoginNotifyReq) XXX_Unmarshal

func (m *LoginNotifyReq) XXX_Unmarshal(b []byte) error

type MsgBody

type MsgBody struct {
	Body                 []byte   `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
	Extend               []byte   `protobuf:"bytes,2,opt,name=extend,proto3" json:"extend,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MsgBody) Descriptor

func (*MsgBody) Descriptor() ([]byte, []int)

func (*MsgBody) GetBody

func (m *MsgBody) GetBody() []byte

func (*MsgBody) GetExtend

func (m *MsgBody) GetExtend() []byte

func (*MsgBody) ProtoMessage

func (*MsgBody) ProtoMessage()

func (*MsgBody) Reset

func (m *MsgBody) Reset()

func (*MsgBody) String

func (m *MsgBody) String() string

func (*MsgBody) XXX_DiscardUnknown

func (m *MsgBody) XXX_DiscardUnknown()

func (*MsgBody) XXX_Marshal

func (m *MsgBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgBody) XXX_Merge

func (m *MsgBody) XXX_Merge(src proto.Message)

func (*MsgBody) XXX_Size

func (m *MsgBody) XXX_Size() int

func (*MsgBody) XXX_Unmarshal

func (m *MsgBody) XXX_Unmarshal(b []byte) error

type MsgHead

type MsgHead struct {
	BodyLen              uint32   `protobuf:"fixed32,1,opt,name=body_len,json=bodyLen,proto3" json:"body_len,omitempty"`
	Version              uint32   `protobuf:"fixed32,2,opt,name=version,proto3" json:"version,omitempty"`
	App                  uint32   `protobuf:"fixed32,3,opt,name=app,proto3" json:"app,omitempty"`
	Server               uint32   `protobuf:"fixed32,4,opt,name=server,proto3" json:"server,omitempty"`
	Servant              uint32   `protobuf:"fixed32,5,opt,name=servant,proto3" json:"servant,omitempty"`
	Seq                  uint32   `protobuf:"fixed32,6,opt,name=seq,proto3" json:"seq,omitempty"`
	RouteId              uint64   `protobuf:"fixed64,7,opt,name=route_id,json=routeId,proto3" json:"route_id,omitempty"`
	Encrypt              uint32   `protobuf:"fixed32,8,opt,name=encrypt,proto3" json:"encrypt,omitempty"`
	CacheIs              uint32   `protobuf:"fixed32,9,opt,name=cache_is,json=cacheIs,proto3" json:"cache_is,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The request message containing the user's name.

func (*MsgHead) Descriptor

func (*MsgHead) Descriptor() ([]byte, []int)

func (*MsgHead) GetApp

func (m *MsgHead) GetApp() uint32

func (*MsgHead) GetBodyLen

func (m *MsgHead) GetBodyLen() uint32

func (*MsgHead) GetCacheIs

func (m *MsgHead) GetCacheIs() uint32

func (*MsgHead) GetEncrypt

func (m *MsgHead) GetEncrypt() uint32

func (*MsgHead) GetRouteId

func (m *MsgHead) GetRouteId() uint64

func (*MsgHead) GetSeq

func (m *MsgHead) GetSeq() uint32

func (*MsgHead) GetServant

func (m *MsgHead) GetServant() uint32

func (*MsgHead) GetServer

func (m *MsgHead) GetServer() uint32

func (*MsgHead) GetVersion

func (m *MsgHead) GetVersion() uint32

func (*MsgHead) ProtoMessage

func (*MsgHead) ProtoMessage()

func (*MsgHead) Reset

func (m *MsgHead) Reset()

func (*MsgHead) String

func (m *MsgHead) String() string

func (*MsgHead) XXX_DiscardUnknown

func (m *MsgHead) XXX_DiscardUnknown()

func (*MsgHead) XXX_Marshal

func (m *MsgHead) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgHead) XXX_Merge

func (m *MsgHead) XXX_Merge(src proto.Message)

func (*MsgHead) XXX_Size

func (m *MsgHead) XXX_Size() int

func (*MsgHead) XXX_Unmarshal

func (m *MsgHead) XXX_Unmarshal(b []byte) error

type ProtoProtocol

type ProtoProtocol struct {
}

func (*ProtoProtocol) Close

func (outInfo *ProtoProtocol) Close(info interface{}) error

func (*ProtoProtocol) NewCodec

func (outInfo *ProtoProtocol) NewCodec(conn net.Conn, timeOut, heartbeat int) interface{}

func (*ProtoProtocol) NoticeClose

func (outInfo *ProtoProtocol) NoticeClose(info interface{})

func (*ProtoProtocol) Receive

func (outInfo *ProtoProtocol) Receive(info interface{}) (interface{}, interface{}, error, int)

func (*ProtoProtocol) Send

func (outInfo *ProtoProtocol) Send(info interface{}, b interface{}) error

type Request

type Request struct {
	Version              uint32   `protobuf:"fixed32,1,opt,name=version,proto3" json:"version,omitempty"`
	Servant              uint32   `protobuf:"fixed32,2,opt,name=servant,proto3" json:"servant,omitempty"`
	Seq                  uint32   `protobuf:"fixed32,3,opt,name=seq,proto3" json:"seq,omitempty"`
	Uid                  uint64   `protobuf:"fixed64,4,opt,name=uid,proto3" json:"uid,omitempty"`
	Body                 []byte   `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The request message containing the user's name.

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetBody

func (m *Request) GetBody() []byte

func (*Request) GetSeq

func (m *Request) GetSeq() uint32

func (*Request) GetServant

func (m *Request) GetServant() uint32

func (*Request) GetUid

func (m *Request) GetUid() uint64

func (*Request) GetVersion

func (m *Request) GetVersion() uint32

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type Respond

type Respond struct {
	Body                 []byte   `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
	Extend               []byte   `protobuf:"bytes,2,opt,name=extend,proto3" json:"extend,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The response message containing the greetings

func (*Respond) Descriptor

func (*Respond) Descriptor() ([]byte, []int)

func (*Respond) GetBody

func (m *Respond) GetBody() []byte

func (*Respond) GetExtend

func (m *Respond) GetExtend() []byte

func (*Respond) ProtoMessage

func (*Respond) ProtoMessage()

func (*Respond) Reset

func (m *Respond) Reset()

func (*Respond) String

func (m *Respond) String() string

func (*Respond) XXX_DiscardUnknown

func (m *Respond) XXX_DiscardUnknown()

func (*Respond) XXX_Marshal

func (m *Respond) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Respond) XXX_Merge

func (m *Respond) XXX_Merge(src proto.Message)

func (*Respond) XXX_Size

func (m *Respond) XXX_Size() int

func (*Respond) XXX_Unmarshal

func (m *Respond) XXX_Unmarshal(b []byte) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

This following code was generated by tarsrpc Gernerated from protocol.proto

func (*Server) AddServant

func (obj *Server) AddServant(imp impServer, objStr string)

AddServant is required by the servant interface

func (*Server) Dispatch

func (obj *Server) Dispatch(ctx context.Context, val interface{}, req *requestf.RequestPacket, resp *requestf.ResponsePacket, withContext bool) (err error)

Dispatch is used to call the user implement of the defined method.

func (*Server) Handle

func (obj *Server) Handle(input Request) (output Respond, err error)

Handle is client rpc method as defined

func (*Server) SetServant

func (obj *Server) SetServant(s model.Servant)

SetServant is required by the servant interface.

func (*Server) TarsSetTimeout

func (obj *Server) TarsSetTimeout(t int)

TarsSetTimeout is required by the servant interface. t is the timeout in ms.

type StApp

type StApp struct {
	Id            uint32     `json:"id,omitempty"`
	Name          string     `json:"name,omitempty"`
	Server        []StServer `json:"server,omitempty"`
	Secret        string     `json:"secret,omitempty"`
	RouteType     int        `json:"routeType,omitempty"`
	Switch        uint32     `json:"switch,omitempty"`    //1开启服务
	BlackList     []string   `json:"blackList,omitempty"` //
	WhiteList     []string   `json:"whiteList,omitempty"` //
	GatewayObject string     `json:"gatewayObject,omitempty"`
}

type StServer

type StServer struct {
	Id        uint32   `json:"id,omitempty"`
	Name      string   `json:"name,omitempty"`
	RouteType int      `json:"routeType,omitempty"`
	Switch    uint32   `json:"switch,omitempty"` //1开启服务
	Secret    string   `json:"secret,omitempty"`
	BlackList []string `json:"blackList,omitempty"` //
	WhiteList []string `json:"whiteList,omitempty"` //
}

type StTarsHttpProxy

type StTarsHttpProxy struct {
	*StTarsHttpProxyCommon

	RouteId uint64
	// contains filtered or unexported fields
}

func (*StTarsHttpProxy) InitProxyHTTP

func (h *StTarsHttpProxy) InitProxyHTTP(key string, p interface{}, ResponseFunc func(p interface{}, rsp *http.Response) error,
	RequestFunc func(p interface{}, w http.ResponseWriter, r *http.Request) (int, error)) (err error)

func (*StTarsHttpProxy) ReloadConf

func (h *StTarsHttpProxy) ReloadConf() (err error)

func (*StTarsHttpProxy) ServeHTTP

func (h *StTarsHttpProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (err error)

实现Handler的接口

type StTarsHttpProxyCommon

type StTarsHttpProxyCommon struct {
	*StTarsProxy
	// contains filtered or unexported fields
}

func (*StTarsHttpProxyCommon) InitProxy

func (info *StTarsHttpProxyCommon) InitProxy(key string, p interface{}, ResponseFunc func(p interface{}, rsp *http.Response) error,
	RequestFunc func(p interface{}, w http.ResponseWriter, r *http.Request) (int, error)) (err error)

type StTarsProxy

type StTarsProxy struct {
	Secret    string  `json:"secret,omitempty"`
	RouteType int     `json:"routeType,omitempty"`
	App       []StApp `json:"app,omitempty"`
	LimitObj  string  `json:"limitObj,omitempty"`
	RouteId   uint64
	// contains filtered or unexported fields
}

func (*StTarsProxy) InitProxy

func (info *StTarsProxy) InitProxy(key string) (err error)

type StTarsProxyTcpCommon

type StTarsProxyTcpCommon struct {
	*StTarsProxy
	// contains filtered or unexported fields
}

func (*StTarsProxyTcpCommon) InitProxy

func (info *StTarsProxyTcpCommon) InitProxy(key string) (err error)

type StTarsTcpProxy

type StTarsTcpProxy struct {
	*StTarsProxyTcpCommon

	RouteId uint64
	// contains filtered or unexported fields
}

func (*StTarsTcpProxy) Close

func (outInfo *StTarsTcpProxy) Close(info interface{})

func (*StTarsTcpProxy) Handle

func (outInfo *StTarsTcpProxy) Handle(info, reqHead, reqBody interface{}) (outHeadRsp []byte, err error)

func (*StTarsTcpProxy) HandlePre

func (outInfo *StTarsTcpProxy) HandlePre(info, reqHead, reqBody interface{}) (limitObj string, reqHeadOut, reqBodyOut interface{}, err error)

func (*StTarsTcpProxy) InitProxy

func (outInfo *StTarsTcpProxy) InitProxy(key string) (err error)

func (*StTarsTcpProxy) IsExit

func (outInfo *StTarsTcpProxy) IsExit(info interface{}) int

func (*StTarsTcpProxy) ReloadConf

func (outInfo *StTarsTcpProxy) ReloadConf() (err error)

func (*StTarsTcpProxy) TcpProxyGet

func (outInfo *StTarsTcpProxy) TcpProxyGet(ip string) interface{}

func (*StTarsTcpProxy) Verify

func (outInfo *StTarsTcpProxy) Verify(info interface{}) error

Jump to

Keyboard shortcuts

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