Documentation
¶
Index ¶
- Constants
- Variables
- type AccessEntry
- type Config
- type HttpAC
- type HttpConfig
- type Peers
- type TokenStore
- type TokenToAccessMap
- type UdpAC
- func (a *UdpAC) AddServerPeer(server *core.UdpPeer)
- func (a *UdpAC) GenerateAccessToken(entry *AccessEntry) string
- func (a *UdpAC) HandleAccessControl(au *common.AgentUser, srcAddrs []*common.NetAddress, ...) (artMsg *common.ACOpsResultMsg, err error)
- func (a *UdpAC) HandleUdpACOperations(ppd *core.PacketParserData) (err error)
- func (a *UdpAC) IpPassMode() int
- func (a *UdpAC) IsRunning() bool
- func (a *UdpAC) RemoveServerPeer(serverKey string)
- func (a *UdpAC) ResolvePeer(peer *core.UdpPeer) (*core.UdpPeer, net.Addr)
- func (a *UdpAC) SendPacket(pkt *core.Packet, conn *UdpConn) (n int, err error)
- func (a *UdpAC) Start(dirPath string, logLevel int) (err error)
- func (ac *UdpAC) Stop()
- func (a *UdpAC) StopConfigWatch()
- func (a *UdpAC) VerifyAccessToken(token string) *AccessEntry
- type UdpConn
Constants ¶
View Source
const ( MaxConcurrentConnection = 256 DefaultConnectionTimeoutMs = 300 * 1000 // 300 seconds to delete idle connection, align with server PacketQueueSizePerConnection = 32 ReportToServerInterval = 60 // seconds MinialServerDiscoveryInterval = 5 // seconds ServerKeepaliveInterval = 20 // seconds ServerDiscoveryRetryBeforeFail = 3 TokenStoreRefreshInterval = 10 TempPortOpenTime = 30 // IPSET_DEFAULT_NAME = "defaultset" IPSET_DEFAULT_DOWN_NAME = "defaultset_down" )
View Source
const ( PASS_KNOCK_IP = iota PASS_KNOCKIP_WITH_RANGE PASS_PRE_ACCESS_IP )
IP pass mode
Variables ¶
View Source
var (
ExeDirPath string
)
Functions ¶
This section is empty.
Types ¶
type AccessEntry ¶ added in v0.4.1
type AccessEntry struct {
User *common.AgentUser
SrcAddrs []*common.NetAddress
DstAddrs []*common.NetAddress
OpenTime int
ExpireTime time.Time
}
type Config ¶
type Config struct {
PrivateKeyBase64 string `json:"privateKey"`
ACId string `json:"acId"`
DefaultIp string `json:"defaultIp"`
AuthServiceId string `json:"aspId"`
ResourceIds []string `json:"resIds"`
Servers []*core.UdpPeer `json:"servers"`
IpPassMode int `json:"ipPassMode"` // 0: pass the knock source IP, 1: use pre-access mode and release the access source IP
LogLevel int `json:"logLevel"`
DefaultCipherScheme int `json:"defaultCipherScheme"`
}
type HttpAC ¶ added in v0.4.1
type HttpAC struct {
// contains filtered or unexported fields
}
func (*HttpAC) HandleHttpRefreshOperations ¶ added in v0.4.1
func (ha *HttpAC) HandleHttpRefreshOperations(c *gin.Context, req *common.HttpRefreshRequest)
func (*HttpAC) Start ¶ added in v0.4.1
func (hs *HttpAC) Start(uac *UdpAC, hc *HttpConfig) error
Note HttpServer must be started after starting UdpAC, when log and config have been setup
func (*HttpAC) Stop ¶ added in v0.4.1
func (hs *HttpAC) Stop()
Stop stops the HttpServer by setting the running flag to false, closing the stop channel, shutting down the underlying http server, waiting for all goroutines to finish, and logging a message indicating that the HttpServer has been stopped.
type HttpConfig ¶ added in v0.4.1
type TokenStore ¶ added in v0.4.1
type TokenStore = map[string]TokenToAccessMap // upper layer of tokens, indexed by first two characters
type TokenToAccessMap ¶ added in v0.4.1
type TokenToAccessMap = map[string]*AccessEntry // access token mapped into user and access information
type UdpAC ¶ added in v0.4.0
type UdpAC struct {
// contains filtered or unexported fields
}
func (*UdpAC) AddServerPeer ¶ added in v0.4.0
func (*UdpAC) GenerateAccessToken ¶ added in v0.4.0
func (a *UdpAC) GenerateAccessToken(entry *AccessEntry) string
func (*UdpAC) HandleAccessControl ¶ added in v0.4.1
func (a *UdpAC) HandleAccessControl(au *common.AgentUser, srcAddrs []*common.NetAddress, dstAddrs []*common.NetAddress, openTimeSec int, artMsgIn *common.ACOpsResultMsg) (artMsg *common.ACOpsResultMsg, err error)
func (*UdpAC) HandleUdpACOperations ¶ added in v0.4.1
func (a *UdpAC) HandleUdpACOperations(ppd *core.PacketParserData) (err error)
func (*UdpAC) IpPassMode ¶ added in v0.4.0
func (*UdpAC) RemoveServerPeer ¶ added in v0.4.0
func (*UdpAC) ResolvePeer ¶ added in v0.4.0
if the server uses hostname as destination, find the correct peer with the actual IP address
func (*UdpAC) SendPacket ¶ added in v0.4.0
func (*UdpAC) Start ¶ added in v0.4.0
dirPath: the path of app or shared library entry point logLevel: 0: silent, 1: error, 2: info, 3: debug, 4: verbose
func (*UdpAC) StopConfigWatch ¶ added in v0.4.0
func (a *UdpAC) StopConfigWatch()
func (*UdpAC) VerifyAccessToken ¶ added in v0.4.0
func (a *UdpAC) VerifyAccessToken(token string) *AccessEntry
Source Files
¶
Click to show internal directories.
Click to hide internal directories.