first commit

main
NorthLan 2 years ago
commit d23be4c91e

17
.gitignore vendored

@ -0,0 +1,17 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
.idea/
.vscode/

@ -0,0 +1,13 @@
Copyright [2022-2025] [NorthLan]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -0,0 +1,5 @@
module git.noahlan.cn/northlan/nnet
go 1.18
require google.golang.org/protobuf v1.28.1 // indirect

@ -0,0 +1,6 @@
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/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 v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=

@ -0,0 +1,7 @@
package interfaces
// IPacket 面向TCP连接中的数据流网络数据包抽象接口
type IPacket interface {
// HeaderLength TCP数据帧头部长度固定长度值
HeaderLength() int
}

@ -0,0 +1,31 @@
package interfaces
// ISessionData Session数据接口
type ISessionData interface {
// Remove 通过key移除数据
Remove(key string)
// Set 设置数据
Set(key string, value interface{})
// Exists key是否存在
Exists(key string) bool
// Value 获取指定key的值
Value(key string) interface{}
// Data 获取所有数据
Data() map[string]interface{}
// SetData 保存所有数据
SetData(data map[string]interface{})
// Clear 清理数据
Clear()
}
// ISession session接口
type ISession interface {
// ID Session ID
ID() int64
// UID 用户自行绑定UID,默认与SessionID一致
UID() interface{}
// Bind 绑定用户ID
Bind(uid interface{})
// ISessionData Session数据抽象方法
ISessionData
}
Loading…
Cancel
Save