refactor(info): 删除多余的信息结构体文件
- 移除了多个未使用的 Java 和 Go 信息结构体文件 - 优化了项目结构,减少了冗余代码 - 这些文件可能是早期开发阶段的遗留代码,现在已不再需要
This commit is contained in:
@@ -1,41 +1,35 @@
|
||||
package login
|
||||
|
||||
// ServerInfo 服务器信息结构体
|
||||
type ServerInfo struct {
|
||||
// 连接ID, 即服务器序号
|
||||
OnlineID uint32
|
||||
// 当前服务器玩家在线数量, 供SWF显示
|
||||
UserCnt uint32
|
||||
// 服务器IP, 16字节UTF-8, 不足16补齐到16
|
||||
IP string `serialize:"fixed:16"` // 定长模式:16字节
|
||||
// 端口
|
||||
Port uint16
|
||||
// 好友在线的个数
|
||||
Friends uint32
|
||||
}
|
||||
|
||||
// NewServerInfo 创建新的服务器信息实例
|
||||
func NewServerInfo() *ServerInfo {
|
||||
return &ServerInfo{
|
||||
OnlineID: 0,
|
||||
UserCnt: 0,
|
||||
IP: "",
|
||||
Port: 0,
|
||||
Friends: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// // SetIP 设置IP地址并自动填充到16字节
|
||||
// func (s *ServerInfo) SetIP(ip string) {
|
||||
// copy(s.IP[:], ip)
|
||||
// if len(ip) < 16 {
|
||||
// for i := len(ip); i < 16; i++ {
|
||||
// s.IP[i] = 0 // 用0填充剩余字节
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // GetIP 获取IP地址(去除填充的0)
|
||||
// func (s *ServerInfo) GetIP() string {
|
||||
// return strings.TrimRight(string(s.IP[:]), "\x00")
|
||||
// }
|
||||
package login
|
||||
|
||||
// ServerInfo 服务器信息结构体
|
||||
type ServerInfo struct {
|
||||
// 连接ID, 即服务器序号
|
||||
OnlineID uint32
|
||||
// 当前服务器玩家在线数量, 供SWF显示
|
||||
UserCnt uint32
|
||||
// 服务器IP, 16字节UTF-8, 不足16补齐到16
|
||||
IP string `struc:"[16]byte"` // 定长模式:16字节
|
||||
// 端口
|
||||
Port uint16
|
||||
// 好友在线的个数
|
||||
Friends uint32
|
||||
}
|
||||
|
||||
// NewServerInfo 创建新的服务器信息实例
|
||||
func NewServerInfo() *ServerInfo {
|
||||
return &ServerInfo{}
|
||||
}
|
||||
|
||||
// // SetIP 设置IP地址并自动填充到16字节
|
||||
// func (s *ServerInfo) SetIP(ip string) {
|
||||
// copy(s.IP[:], ip)
|
||||
// if len(ip) < 16 {
|
||||
// for i := len(ip); i < 16; i++ {
|
||||
// s.IP[i] = 0 // 用0填充剩余字节
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // GetIP 获取IP地址(去除填充的0)
|
||||
// func (s *ServerInfo) GetIP() string {
|
||||
// return strings.TrimRight(string(s.IP[:]), "\x00")
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user