Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeKey(encodedKey string) ([]byte, error)
- func DecodeZtoFile(ztdofileName string, decodeBase64Key string, newFileSaveDir string)
- func EncodeToZtoFile(sourceFilePath string, targetZtdoFilePath string, ...) (zoId string, encryptionKey string)
- func GenerateKey() (string, error)
- func ReadMetaFile(filePath string) (core.ZtdoMetaInfo, error)
- func ReadPolicyFile(filePath string) (common.DHPPolicy, error)
- func WriteConfig(key string, objectId string) error
- type Config
- type KnockResource
- type KnockTarget
- type KnockUser
- type Peers
- type Resources
- type UdpConn
- type UdpDevice
- func (a *UdpDevice) AddServer(server *core.UdpPeer)
- func (a *UdpDevice) GetServerPeer() (serverPeer *core.UdpPeer)
- func (a *UdpDevice) IsRunning() bool
- func (a *UdpDevice) RemoveServer(serverKey string)
- func (a *UdpDevice) ResolvePeer(peer *core.UdpPeer) (*core.UdpPeer, net.Addr)
- func (a *UdpDevice) SendDHPRegister(doId string, policy common.DHPPolicy, dataKey string)
- func (a *UdpDevice) SendNHPDRG(server *core.UdpPeer, msg common.DRGMsg) bool
- func (a *UdpDevice) SendPacket(pkt *core.Packet, conn *UdpConn) (n int, err error)
- func (a *UdpDevice) Start(dirPath string, logLevel int) (err error)
- func (a *UdpDevice) Stop()
- func (a *UdpDevice) StopConfigWatch()
- type ZtdoConfig
Constants ¶
View Source
const ( MaxConcurrentConnection = 256 DefaultConnectionTimeoutMs = 30 * 1000 // 30 seconds to delete idle connection PacketQueueSizePerConnection = 8 // nhp agent does not need large transactions DoType_Default = "ZTDO" //The DHP protocol enforces encryption by default, and its core data unit is the Zero Trust Data Object (ZTDO)。 DoType_Other = "OTHER" )
Variables ¶
View Source
var (
ExeDirPath string
)
Functions ¶
func DecodeZtoFile ¶
func EncodeToZtoFile ¶
func EncodeToZtoFile(sourceFilePath string, targetZtdoFilePath string, ztoMetaInfo core.ZtdoMetaInfo) (zoId string, encryptionKey string)
EncodeToZtoFile * sourceFilePath: targetZtdoFilePath:
func GenerateKey ¶
Generates a 256-bit random key and returns a Base64-encoded string
func ReadPolicyFile ¶
read Polic file
func WriteConfig ¶
WriteConfig writes to etc/config.json file
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 UdpConn ¶
type UdpConn struct {
ConnData *core.ConnectionData
// contains filtered or unexported fields
}
type UdpDevice ¶
type UdpDevice struct {
// contains filtered or unexported fields
}
func (*UdpDevice) GetServerPeer ¶
get first server
func (*UdpDevice) RemoveServer ¶
func (*UdpDevice) ResolvePeer ¶
if the server uses hostname as destination, find the correct peer with the actual IP address
func (*UdpDevice) SendDHPRegister ¶
func (*UdpDevice) SendNHPDRG ¶
send NHP_DRG to NHP-Server
func (*UdpDevice) SendPacket ¶
func (*UdpDevice) Start ¶
dirPath: the path of app or shared library entry point logLevel: 0: silent, 1: error, 2: info, 3: debug, 4: verbose
func (*UdpDevice) StopConfigWatch ¶
func (a *UdpDevice) StopConfigWatch()
type ZtdoConfig ¶
type ZtdoConfig struct {
EncryptionKey string `json:"encryptionKey"`
}
The Config structure is used to represent the structure of the configuration file
Click to show internal directories.
Click to hide internal directories.