socket

package
v0.0.0-...-eaebcad Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const SESS_PRESET_FILTER = "PRESET_FILTER"
View Source
const SOCKET_ID_LEN = 32

Variables

This section is empty.

Functions

func GenSocketID

func GenSocketID() string

func GetRemoteAddrIP

func GetRemoteAddrIP(remoteAddr string) string

func RegisterPresetFilter

func RegisterPresetFilter()

Types

type ClientSocket

type ClientSocket struct {
	ID   string //emitter unique ID
	Conn net.Conn

	PacketID     uint32
	Token        string
	TokenExpires time.Time
	LastActivity time.Time
	StartTime    time.Time
	Session      session.Session
	// contains filtered or unexported fields
}

func NewClientSocket

func NewClientSocket(conn net.Conn, token string, tokenExp time.Time) *ClientSocket

************* id string, ID: id,

func (*ClientSocket) Close

func (s *ClientSocket) Close()

func (*ClientSocket) GetConn

func (s *ClientSocket) GetConn() net.Conn

func (*ClientSocket) GetDescr

func (s *ClientSocket) GetDescr() string

func (*ClientSocket) GetID

func (s *ClientSocket) GetID() string

func (*ClientSocket) GetIP

func (s *ClientSocket) GetIP() string

func (*ClientSocket) GetLastActivity

func (s *ClientSocket) GetLastActivity() time.Time

func (*ClientSocket) GetPacketID

func (s *ClientSocket) GetPacketID() uint32

func (*ClientSocket) GetPresetFilter

func (s *ClientSocket) GetPresetFilter(modelID string) sql.FilterCondCollection

func (*ClientSocket) GetSession

func (s *ClientSocket) GetSession() session.Session

func (*ClientSocket) GetToken

func (s *ClientSocket) GetToken() string

func (*ClientSocket) GetTokenExpires

func (s *ClientSocket) GetTokenExpires() time.Time

func (*ClientSocket) SetPresetFilter

func (s *ClientSocket) SetPresetFilter(f PresetFilter) error

func (*ClientSocket) SetSession

func (s *ClientSocket) SetSession(sess session.Session)

func (*ClientSocket) SetToken

func (s *ClientSocket) SetToken(token string)

func (*ClientSocket) SetTokenExpires

func (s *ClientSocket) SetTokenExpires(t time.Time)

func (*ClientSocket) UpdateLastActivity

func (s *ClientSocket) UpdateLastActivity()

type ClientSocketList

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

Structure for managing client sockets

func NewClientSocketList

func NewClientSocketList() *ClientSocketList

func (*ClientSocketList) Append

func (l *ClientSocketList) Append(socket ClientSocketer)

func (*ClientSocketList) Iter

func (l *ClientSocketList) Iter() <-chan ClientSocketer

Iterates over the events in the concurrent slice

func (ClientSocketList) Len

func (l ClientSocketList) Len() int

func (*ClientSocketList) Remove

func (l *ClientSocketList) Remove(socket ClientSocketer)

type ClientSocketer

type ClientSocketer interface {
	GetID() string
	GetDescr() string
	Close()
	GetConn() net.Conn
	SetToken(string)
	GetToken() string
	SetTokenExpires(time.Time)
	GetTokenExpires() time.Time
	UpdateLastActivity()
	SetSession(session.Session)
	GetSession() session.Session
	GetPacketID() uint32
	GetIP() string
	GetPresetFilter(string) sql.FilterCondCollection
	SetPresetFilter(PresetFilter) error
	GetLastActivity() time.Time
}

Interface for client sockets

type PresetFilter

type PresetFilter map[string]sql.FilterCondCollection

Individual global filter

func NewPresetFilter

func NewPresetFilter() PresetFilter

func (*PresetFilter) Add

func (f *PresetFilter) Add(modelID string, conditions sql.FilterCondCollection)

func (*PresetFilter) Get

func (f *PresetFilter) Get(modelID string) sql.FilterCondCollection

Jump to

Keyboard shortcuts

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