Add gitignore vscode, add friends blockeduser, add go.sum

This commit is contained in:
殷勇 2023-08-18 11:38:15 +08:00
parent 59a7e18a0e
commit 2779be6f5d
11 changed files with 149 additions and 322 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ node_modules/
nohup.out
bin/
.idea
.vscode

16
server/guildserver/go.sum Normal file
View File

@ -0,0 +1,16 @@
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=

16
server/hallserver/go.sum Normal file
View File

@ -0,0 +1,16 @@
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=

View File

@ -5,25 +5,20 @@ import (
proto "github.com/golang/protobuf/proto"
)
type CsNetMsgHandler f5.NetMsgHandler[MsgHandler];
type MsgHandlerImpl struct {
}
type NetMsgHandler struct {
MsgId int
HandlerId int
parseCb func([]byte) interface{}
cb func(*f5.MsgHdr, MsgHandler)
}
var handlers [2000]*CsNetMsgHandler
var handlers [2000]*NetMsgHandler
func GetNetMsgHandler(msgId uint16) *NetMsgHandler {
func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler {
handler := handlers[msgId]
return handler
}
func DispatchMsg(handler *NetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) {
handler.cb(hdr, msgHandler)
func DispatchMsg(handler *CsNetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) {
handler.Cb(hdr, msgHandler)
}
func RegHandlerId(msgId int, handlerId int) {
@ -36,7 +31,7 @@ func ParsePb(msgId uint16, data []byte) interface{} {
if handler == nil {
return nil
}
return handler.parseCb(data)
return handler.ParseCb(data)
}
type MsgHandler interface {
@ -144,98 +139,98 @@ func (this *SMListFriend) GetNetMsgId() uint16 {
func init() {
handlers[int(CMMessageIdE__CMPing)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMPing),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMPing{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMPing(hdr, hdr.Msg.(*CMPing))
},
}
handlers[int(CMMessageIdE__CMLogin)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMLogin)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMLogin),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMLogin{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMLogin(hdr, hdr.Msg.(*CMLogin))
},
}
handlers[int(CMMessageIdE__CMReconnect)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMReconnect)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMReconnect),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMReconnect{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMReconnect(hdr, hdr.Msg.(*CMReconnect))
},
}
handlers[int(CMMessageIdE__CMSearchFriend)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMSearchFriend)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMSearchFriend),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMSearchFriend{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMSearchFriend(hdr, hdr.Msg.(*CMSearchFriend))
},
}
handlers[int(CMMessageIdE__CMListPendingFriendRequest)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMListPendingFriendRequest)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMListPendingFriendRequest),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMListPendingFriendRequest{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMListPendingFriendRequest(hdr, hdr.Msg.(*CMListPendingFriendRequest))
},
}
handlers[int(CMMessageIdE__CMAddFriendRequest)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMAddFriendRequest)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMAddFriendRequest),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMAddFriendRequest{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMAddFriendRequest(hdr, hdr.Msg.(*CMAddFriendRequest))
},
}
handlers[int(CMMessageIdE__CMAcceptFriendRequest)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMAcceptFriendRequest)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMAcceptFriendRequest),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMAcceptFriendRequest{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMAcceptFriendRequest(hdr, hdr.Msg.(*CMAcceptFriendRequest))
},
}
handlers[int(CMMessageIdE__CMListFriend)] = &NetMsgHandler{
handlers[int(CMMessageIdE__CMListFriend)] = &CsNetMsgHandler{
MsgId: int(CMMessageIdE__CMListFriend),
parseCb: func (data []byte) interface{} {
ParseCb: func (data []byte) interface{} {
msg := &CMListFriend{}
proto.Unmarshal(data, msg)
return msg
},
cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.CMListFriend(hdr, hdr.Msg.(*CMListFriend))
},
}

View File

@ -1,9 +1,6 @@
package main
import (
"math/rand"
"strings"
)
import "q5"
// User 用户实体
type User struct {
@ -23,27 +20,13 @@ type FriendRequest struct {
ReceiverID int
}
// BlockedUser 直接存列表, 黑名单上限就50个
type BlockedUser struct {
AccountId string
BlockedAccountId string
}
// RandomString generates a random string of length n
const alphabet = "abcdefghijklmnopqrstuvwxyz"
func RandomString(n int) string {
var sb strings.Builder
k := len(alphabet)
for i := 0; i < n; i++ {
c := alphabet[rand.Intn(k)]
sb.WriteByte(c)
}
return sb.String()
}
// RandomUsername generates a random username
func RandomUsername() string {
return RandomString(6)
return q5.RandomString(6)
}

View File

@ -93,6 +93,7 @@ func (fm *FriendsMgr) searchUsers(keyword string) []*User {
}
}
maxUsers := 20
var listFriend []*User
lowercaseQuery := strings.ToLower(keyword)
for _, u := range fm.users {
@ -103,6 +104,10 @@ func (fm *FriendsMgr) searchUsers(keyword string) []*User {
}
listFriend = append(listFriend, uEntity)
}
// 显示搜索结果 20条
if len(listFriend) >= maxUsers {
break
}
}
// Add to caches
@ -119,11 +124,33 @@ func (fm *FriendsMgr) addBlocked(account1Id string, account2Id string) error {
if fm.blockedUser[account1Id] == nil {
fm.blockedUser[account1Id] = []string{}
}
if len(fm.blockedUser[account1Id]) >= 50 {
return fmt.Errorf("your blacklist has reached the limit")
}
index := fm.findBlockedUserIndex(account1Id, account2Id)
if index < 0 {
fm.blockedUser[account1Id] = append(fm.blockedUser[account1Id], account2Id)
}
return nil
}
func (fm *FriendsMgr) removeBlocked(account1Id string, account2Id string) error {
if fm.blockedUser[account1Id] == nil {
return fmt.Errorf("your blacklist is emtpy")
}
index := fm.findBlockedUserIndex(account1Id, account2Id)
if index < 0 {
return fmt.Errorf("your blacklist not exists target account id")
}
blockedUsers := fm.blockedUser[account1Id]
blockedUsers = append(blockedUsers[:index], blockedUsers[index+1:]...)
fm.blockedUser[account1Id] = blockedUsers
return nil
}
@ -394,3 +421,12 @@ func PrintUsers(str string, userList []*User) {
fmt.Printf("[%s]:accountId:%s, username:%s \n", str, user.AccountId, user.Username)
}
}
func (fm *FriendsMgr) findBlockedUserIndex(AccountId1, AccountId2 string) int {
for i, blockedAccountId := range fm.blockedUser[AccountId1] {
if blockedAccountId == AccountId2 {
return i
}
}
return -1
}

View File

@ -1,6 +1,5 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=

View File

@ -38,8 +38,6 @@ type MsgHandler interface {
SS_Ping(*f5.MsgHdr, *SS_Ping)
SS_Pong(*f5.MsgHdr, *SS_Pong)
SS_WSP_SocketDisconnect(*f5.MsgHdr, *SS_WSP_SocketDisconnect)
SS_WSP_RequestTargetServer(*f5.MsgHdr, *SS_WSP_RequestTargetServer)
SS_MS_ResponseTargetServer(*f5.MsgHdr, *SS_MS_ResponseTargetServer)
SS_ForceCloseSocket(*f5.MsgHdr, *SS_ForceCloseSocket)
}
@ -52,12 +50,6 @@ func (this *MsgHandlerImpl) SS_Pong(hdr *f5.MsgHdr, msg *SS_Pong) {
func (this *MsgHandlerImpl) SS_WSP_SocketDisconnect(hdr *f5.MsgHdr, msg *SS_WSP_SocketDisconnect) {
}
func (this *MsgHandlerImpl) SS_WSP_RequestTargetServer(hdr *f5.MsgHdr, msg *SS_WSP_RequestTargetServer) {
}
func (this *MsgHandlerImpl) SS_MS_ResponseTargetServer(hdr *f5.MsgHdr, msg *SS_MS_ResponseTargetServer) {
}
func (this *MsgHandlerImpl) SS_ForceCloseSocket(hdr *f5.MsgHdr, msg *SS_ForceCloseSocket) {
}
@ -73,14 +65,6 @@ func (this *SS_WSP_SocketDisconnect) GetNetMsgId() uint16 {
return uint16(SSMessageIdE__SS_WSP_SocketDisconnect)
}
func (this *SS_WSP_RequestTargetServer) GetNetMsgId() uint16 {
return uint16(SSMessageIdE__SS_WSP_RequestTargetServer)
}
func (this *SS_MS_ResponseTargetServer) GetNetMsgId() uint16 {
return uint16(SSMessageIdE__SS_MS_ResponseTargetServer)
}
func (this *SS_ForceCloseSocket) GetNetMsgId() uint16 {
return uint16(SSMessageIdE__SS_ForceCloseSocket)
}
@ -123,30 +107,6 @@ func init() {
},
}
handlers[int(SSMessageIdE__SS_WSP_RequestTargetServer)] = &SsNetMsgHandler{
MsgId: int(SSMessageIdE__SS_WSP_RequestTargetServer),
ParseCb: func (data []byte) interface{} {
msg := &SS_WSP_RequestTargetServer{}
proto.Unmarshal(data, msg)
return msg
},
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.SS_WSP_RequestTargetServer(hdr, hdr.Msg.(*SS_WSP_RequestTargetServer))
},
}
handlers[int(SSMessageIdE__SS_MS_ResponseTargetServer)] = &SsNetMsgHandler{
MsgId: int(SSMessageIdE__SS_MS_ResponseTargetServer),
ParseCb: func (data []byte) interface{} {
msg := &SS_MS_ResponseTargetServer{}
proto.Unmarshal(data, msg)
return msg
},
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
handler.SS_MS_ResponseTargetServer(hdr, hdr.Msg.(*SS_MS_ResponseTargetServer))
},
}
handlers[int(SSMessageIdE__SS_ForceCloseSocket)] = &SsNetMsgHandler{
MsgId: int(SSMessageIdE__SS_ForceCloseSocket),
ParseCb: func (data []byte) interface{} {

View File

@ -27,8 +27,6 @@ const (
SSMessageIdE__SS_Ping SSMessageIdE = 8
SSMessageIdE__SS_Pong SSMessageIdE = 9
SSMessageIdE__SS_WSP_SocketDisconnect SSMessageIdE = 10
SSMessageIdE__SS_WSP_RequestTargetServer SSMessageIdE = 11
SSMessageIdE__SS_MS_ResponseTargetServer SSMessageIdE = 12
SSMessageIdE__SS_ForceCloseSocket SSMessageIdE = 13
)
@ -38,16 +36,12 @@ var (
8: "_SS_Ping",
9: "_SS_Pong",
10: "_SS_WSP_SocketDisconnect",
11: "_SS_WSP_RequestTargetServer",
12: "_SS_MS_ResponseTargetServer",
13: "_SS_ForceCloseSocket",
}
SSMessageIdE_value = map[string]int32{
"_SS_Ping": 8,
"_SS_Pong": 9,
"_SS_WSP_SocketDisconnect": 10,
"_SS_WSP_RequestTargetServer": 11,
"_SS_MS_ResponseTargetServer": 12,
"_SS_ForceCloseSocket": 13,
}
)
@ -93,18 +87,14 @@ var File_ss_msgid_proto protoreflect.FileDescriptor
var file_ss_msgid_proto_rawDesc = []byte{
0x0a, 0x0e, 0x73, 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x02, 0x73, 0x73, 0x2a, 0xa5, 0x01, 0x0a, 0x0d, 0x53, 0x53, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x53, 0x5f, 0x50, 0x69,
0x6e, 0x67, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x53, 0x5f, 0x50, 0x6f, 0x6e, 0x67,
0x10, 0x09, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x53, 0x53, 0x5f, 0x57, 0x53, 0x50, 0x5f, 0x53, 0x6f,
0x63, 0x6b, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x0a,
0x12, 0x1f, 0x0a, 0x1b, 0x5f, 0x53, 0x53, 0x5f, 0x57, 0x53, 0x50, 0x5f, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x10,
0x0b, 0x12, 0x1f, 0x0a, 0x1b, 0x5f, 0x53, 0x53, 0x5f, 0x4d, 0x53, 0x5f, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x10, 0x0c, 0x12, 0x18, 0x0a, 0x14, 0x5f, 0x53, 0x53, 0x5f, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43,
0x6c, 0x6f, 0x73, 0x65, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x0d, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x73, 0x73,
0x12, 0x02, 0x73, 0x73, 0x2a, 0x63, 0x0a, 0x0d, 0x53, 0x53, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x53, 0x5f, 0x50, 0x69, 0x6e,
0x67, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x53, 0x5f, 0x50, 0x6f, 0x6e, 0x67, 0x10,
0x09, 0x12, 0x1c, 0x0a, 0x18, 0x5f, 0x53, 0x53, 0x5f, 0x57, 0x53, 0x50, 0x5f, 0x53, 0x6f, 0x63,
0x6b, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x0a, 0x12,
0x18, 0x0a, 0x14, 0x5f, 0x53, 0x53, 0x5f, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73,
0x65, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x10, 0x0d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x73,
0x73,
}
var (

View File

@ -134,148 +134,6 @@ func (*SS_WSP_SocketDisconnect) Descriptor() ([]byte, []int) {
return file_ss_proto_proto_rawDescGZIP(), []int{2}
}
type SS_WSP_RequestTargetServer struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ContextId *int64 `protobuf:"varint,1,opt,name=context_id,json=contextId" json:"context_id,omitempty"`
AccountId *string `protobuf:"bytes,2,opt,name=account_id,json=accountId" json:"account_id,omitempty"`
TeamId *string `protobuf:"bytes,3,opt,name=team_id,json=teamId" json:"team_id,omitempty"`
}
func (x *SS_WSP_RequestTargetServer) Reset() {
*x = SS_WSP_RequestTargetServer{}
if protoimpl.UnsafeEnabled {
mi := &file_ss_proto_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SS_WSP_RequestTargetServer) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SS_WSP_RequestTargetServer) ProtoMessage() {}
func (x *SS_WSP_RequestTargetServer) ProtoReflect() protoreflect.Message {
mi := &file_ss_proto_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SS_WSP_RequestTargetServer.ProtoReflect.Descriptor instead.
func (*SS_WSP_RequestTargetServer) Descriptor() ([]byte, []int) {
return file_ss_proto_proto_rawDescGZIP(), []int{3}
}
func (x *SS_WSP_RequestTargetServer) GetContextId() int64 {
if x != nil && x.ContextId != nil {
return *x.ContextId
}
return 0
}
func (x *SS_WSP_RequestTargetServer) GetAccountId() string {
if x != nil && x.AccountId != nil {
return *x.AccountId
}
return ""
}
func (x *SS_WSP_RequestTargetServer) GetTeamId() string {
if x != nil && x.TeamId != nil {
return *x.TeamId
}
return ""
}
type SS_MS_ResponseTargetServer struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ErrorCode *int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode" json:"error_code,omitempty"`
ErrorMsg *string `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg" json:"error_msg,omitempty"`
ContextId *int64 `protobuf:"varint,3,opt,name=context_id,json=contextId" json:"context_id,omitempty"`
Host *string `protobuf:"bytes,4,opt,name=host" json:"host,omitempty"`
Port *int32 `protobuf:"varint,5,opt,name=port" json:"port,omitempty"`
}
func (x *SS_MS_ResponseTargetServer) Reset() {
*x = SS_MS_ResponseTargetServer{}
if protoimpl.UnsafeEnabled {
mi := &file_ss_proto_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SS_MS_ResponseTargetServer) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SS_MS_ResponseTargetServer) ProtoMessage() {}
func (x *SS_MS_ResponseTargetServer) ProtoReflect() protoreflect.Message {
mi := &file_ss_proto_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SS_MS_ResponseTargetServer.ProtoReflect.Descriptor instead.
func (*SS_MS_ResponseTargetServer) Descriptor() ([]byte, []int) {
return file_ss_proto_proto_rawDescGZIP(), []int{4}
}
func (x *SS_MS_ResponseTargetServer) GetErrorCode() int32 {
if x != nil && x.ErrorCode != nil {
return *x.ErrorCode
}
return 0
}
func (x *SS_MS_ResponseTargetServer) GetErrorMsg() string {
if x != nil && x.ErrorMsg != nil {
return *x.ErrorMsg
}
return ""
}
func (x *SS_MS_ResponseTargetServer) GetContextId() int64 {
if x != nil && x.ContextId != nil {
return *x.ContextId
}
return 0
}
func (x *SS_MS_ResponseTargetServer) GetHost() string {
if x != nil && x.Host != nil {
return *x.Host
}
return ""
}
func (x *SS_MS_ResponseTargetServer) GetPort() int32 {
if x != nil && x.Port != nil {
return *x.Port
}
return 0
}
type SS_ForceCloseSocket struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -285,7 +143,7 @@ type SS_ForceCloseSocket struct {
func (x *SS_ForceCloseSocket) Reset() {
*x = SS_ForceCloseSocket{}
if protoimpl.UnsafeEnabled {
mi := &file_ss_proto_proto_msgTypes[5]
mi := &file_ss_proto_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -298,7 +156,7 @@ func (x *SS_ForceCloseSocket) String() string {
func (*SS_ForceCloseSocket) ProtoMessage() {}
func (x *SS_ForceCloseSocket) ProtoReflect() protoreflect.Message {
mi := &file_ss_proto_proto_msgTypes[5]
mi := &file_ss_proto_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -311,7 +169,7 @@ func (x *SS_ForceCloseSocket) ProtoReflect() protoreflect.Message {
// Deprecated: Use SS_ForceCloseSocket.ProtoReflect.Descriptor instead.
func (*SS_ForceCloseSocket) Descriptor() ([]byte, []int) {
return file_ss_proto_proto_rawDescGZIP(), []int{5}
return file_ss_proto_proto_rawDescGZIP(), []int{3}
}
var File_ss_proto_proto protoreflect.FileDescriptor
@ -321,26 +179,9 @@ var file_ss_proto_proto_rawDesc = []byte{
0x12, 0x02, 0x73, 0x73, 0x22, 0x09, 0x0a, 0x07, 0x53, 0x53, 0x5f, 0x50, 0x69, 0x6e, 0x67, 0x22,
0x09, 0x0a, 0x07, 0x53, 0x53, 0x5f, 0x50, 0x6f, 0x6e, 0x67, 0x22, 0x19, 0x0a, 0x17, 0x53, 0x53,
0x5f, 0x57, 0x53, 0x50, 0x5f, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x6f,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x22, 0x73, 0x0a, 0x1a, 0x53, 0x53, 0x5f, 0x57, 0x53, 0x50, 0x5f,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x9f, 0x01, 0x0a, 0x1a, 0x53,
0x53, 0x5f, 0x4d, 0x53, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x61, 0x72,
0x67, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65,
0x78, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74,
0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x15, 0x0a, 0x13,
0x53, 0x53, 0x5f, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x6f, 0x63,
0x6b, 0x65, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x73, 0x73,
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x53, 0x5f, 0x46, 0x6f, 0x72, 0x63,
0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x73, 0x73,
}
var (
@ -355,14 +196,12 @@ func file_ss_proto_proto_rawDescGZIP() []byte {
return file_ss_proto_proto_rawDescData
}
var file_ss_proto_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_ss_proto_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_ss_proto_proto_goTypes = []interface{}{
(*SS_Ping)(nil), // 0: ss.SS_Ping
(*SS_Pong)(nil), // 1: ss.SS_Pong
(*SS_WSP_SocketDisconnect)(nil), // 2: ss.SS_WSP_SocketDisconnect
(*SS_WSP_RequestTargetServer)(nil), // 3: ss.SS_WSP_RequestTargetServer
(*SS_MS_ResponseTargetServer)(nil), // 4: ss.SS_MS_ResponseTargetServer
(*SS_ForceCloseSocket)(nil), // 5: ss.SS_ForceCloseSocket
(*SS_ForceCloseSocket)(nil), // 3: ss.SS_ForceCloseSocket
}
var file_ss_proto_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@ -415,30 +254,6 @@ func file_ss_proto_proto_init() {
}
}
file_ss_proto_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SS_WSP_RequestTargetServer); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ss_proto_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SS_MS_ResponseTargetServer); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ss_proto_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SS_ForceCloseSocket); i {
case 0:
return &v.state
@ -457,7 +272,7 @@ func file_ss_proto_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ss_proto_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},

16
server/slgserver/go.sum Normal file
View File

@ -0,0 +1,16 @@
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=