Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type KnockResource
- type KnockTarget
- type KnockUser
- type Peers
- type Resources
- type UdpAgent
- func (a *UdpAgent) AddResource(res *KnockResource) error
- func (a *UdpAgent) AddServer(server *core.UdpPeer)
- func (a *UdpAgent) ExitKnockRequest(res *KnockTarget) (ackMsg *common.ServerKnockAckMsg, err error)
- func (a *UdpAgent) FindServerPeerFromResource(res *KnockResource) *core.UdpPeer
- func (a *UdpAgent) HandleCookieMessage(ppd *core.PacketParserData) bool
- func (a *UdpAgent) IsRunning() bool
- func (a *UdpAgent) Knock(res *KnockTarget) (ackMsg *common.ServerKnockAckMsg, err error)
- func (a *UdpAgent) ListResource(target *KnockTarget) (lrtMsg *common.ServerListResultMsg, err error)
- func (a *UdpAgent) RegisterPublicKey(otp string, target *KnockTarget) (rakMsg *common.ServerRegisterAckMsg, err error)
- func (a *UdpAgent) RemoveResource(aspId string, resId string)
- func (a *UdpAgent) RemoveServer(serverKey string)
- func (a *UdpAgent) RequestOtp(target *KnockTarget) error
- func (a *UdpAgent) ResolvePeer(peer *core.UdpPeer) (*core.UdpPeer, net.Addr)
- func (a *UdpAgent) SendPacket(pkt *core.Packet, conn *UdpConn) (n int, err error)
- func (a *UdpAgent) SetCheckResults(results map[string]any)
- func (a *UdpAgent) SetDeviceId(devId string)
- func (a *UdpAgent) SetKnockUser(usrId string, orgId string, userData map[string]any)
- func (a *UdpAgent) Start(dirPath string, logLevel int) (err error)
- func (a *UdpAgent) StartKnockLoop() int
- func (a *UdpAgent) Stop()
- func (a *UdpAgent) StopConfigWatch()
- func (a *UdpAgent) StopKnockLoop()
- type UdpConn
Constants ¶
View Source
const ( MaxConcurrentConnection = 256 DefaultConnectionTimeoutMs = 30 * 1000 // 30 seconds to delete idle connection PacketQueueSizePerConnection = 8 // nhp agent does not need large transactions )
Variables ¶
View Source
var (
ExeDirPath string
)
Functions ¶
This section is empty.
Types ¶
type KnockResource ¶
type KnockResource struct { AuthServiceId string `json:"aspId"` ResourceId string `json:"resId"` ServerAddr string `json:"serverAddr"` }
func (*KnockResource) Id ¶
func (res *KnockResource) Id() string
type KnockTarget ¶
type KnockTarget struct { sync.Mutex KnockResource ServerPeer *core.UdpPeer LastKnockSuccessTime time.Time }
func (*KnockTarget) Server ¶
func (kt *KnockTarget) Server() *core.UdpPeer
func (*KnockTarget) SetResource ¶
func (kt *KnockTarget) SetResource(res *KnockResource)
func (*KnockTarget) SetServer ¶
func (kt *KnockTarget) SetServer(peer *core.UdpPeer)
type Resources ¶
type Resources struct {
Resources []*KnockResource
}
type UdpAgent ¶
type UdpAgent struct {
// contains filtered or unexported fields
}
func (*UdpAgent) AddResource ¶
func (a *UdpAgent) AddResource(res *KnockResource) error
func (*UdpAgent) ExitKnockRequest ¶
func (a *UdpAgent) ExitKnockRequest(res *KnockTarget) (ackMsg *common.ServerKnockAckMsg, err error)
func (*UdpAgent) FindServerPeerFromResource ¶
func (a *UdpAgent) FindServerPeerFromResource(res *KnockResource) *core.UdpPeer
func (*UdpAgent) HandleCookieMessage ¶
func (a *UdpAgent) HandleCookieMessage(ppd *core.PacketParserData) bool
func (*UdpAgent) Knock ¶
func (a *UdpAgent) Knock(res *KnockTarget) (ackMsg *common.ServerKnockAckMsg, err error)
func (*UdpAgent) ListResource ¶
func (a *UdpAgent) ListResource(target *KnockTarget) (lrtMsg *common.ServerListResultMsg, err error)
func (*UdpAgent) RegisterPublicKey ¶
func (a *UdpAgent) RegisterPublicKey(otp string, target *KnockTarget) (rakMsg *common.ServerRegisterAckMsg, err error)
func (*UdpAgent) RemoveResource ¶
func (*UdpAgent) RemoveServer ¶
func (*UdpAgent) RequestOtp ¶
func (a *UdpAgent) RequestOtp(target *KnockTarget) error
func (*UdpAgent) ResolvePeer ¶
if the server uses hostname as destination, find the correct peer with the actual IP address
func (*UdpAgent) SendPacket ¶
func (*UdpAgent) SetCheckResults ¶
func (*UdpAgent) SetDeviceId ¶
func (*UdpAgent) SetKnockUser ¶
func (*UdpAgent) Start ¶
dirPath: the path of app or shared library entry point logLevel: 0: silent, 1: error, 2: info, 3: debug, 4: verbose
func (*UdpAgent) StartKnockLoop ¶
func (*UdpAgent) StopConfigWatch ¶
func (a *UdpAgent) StopConfigWatch()
func (*UdpAgent) StopKnockLoop ¶
func (a *UdpAgent) StopKnockLoop()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.