Documentation
¶
Index ¶
- Variables
- func ErrorToErrorCode(err error) string
- func ErrorToString(err error) string
- type ACAccessAckMsg
- type ACOnlineMsg
- type ACOpsResultMsg
- type ACRefreshMsg
- type AgentAccessMsg
- type AgentKnockMsg
- type AgentListMsg
- type AgentOTPMsg
- type AgentRegisterMsg
- type AgentUser
- type AuthServiceProviderData
- type AuthSvcProviderMap
- type DAGMsg
- type DAKMsg
- type DARMsg
- type DHPKao
- type DHPPolicy
- type DPCMsg
- type DPVMsg
- type DRGMsg
- type Error
- type HttpKnockRequest
- type HttpRefreshRequest
- type LoginPageContext
- type NetAddress
- type NhpAuthRequest
- type NhpListRequest
- type NhpOTPRequest
- type NhpRegisterRequest
- type PreAccessInfo
- type ResourceData
- type ResourceGroup
- type ResourceGroupMap
- type ResourceInfo
- type ServerACAckMsg
- type ServerACOpsMsg
- type ServerCookieMsg
- type ServerKnockAckMsg
- type ServerListResultMsg
- type ServerRegisterAckMsg
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // generic ErrSuccess = newError("0", "", "") ErrExit = newError("1", "must exit", "立即退出") ErrJsonParseFailed = newError("50001", "json parse failed", "json解析失败") ErrTransactionIdNotFound = newError("50002", "transaction id not found", "无法找到交互id") ErrTransactionFailedByTimeout = newError("50003", "transaction failed due to time out", "请求超时,交互失败") ErrTransactionFailedByClosedConnection = newError("50004", "transaction failed by closed connection", "由于连接中断,交互失败") ErrTransactionFailedByClosedDevice = newError("50005", "transaction failed by closed device", "由于设备停止,交互失败") ErrTransactionRepliedWithWrongType = newError("50006", "transaction replied wrong type", "交互回应了错误的消息类型") ErrPacketToMessageRoutineStopped = newError("50007", "packet to message routine stopped", "消息处理线程已停止") ErrInvalidIpAddress = newError("50008", "invalid ip address", "ip地址无效") ErrPacketEncryptionFailed = newError("50009", "packet encryption failed", "报文加密失败") // agent ErrKnockUserNotSpecified = newError("51001", "knock user not specified", "没有指定敲门用户") ErrKnockServerNotFound = newError("51002", "failed to find knock server", "无法找到敲门服务器") ErrKnockTerminatedByCookie = newError("51003", "knock terminated by cookie", "敲门被cookie包中止") // agentsdk ErrNoAgentInstance = newError("51100", "agent instance does not exist", "未创建agent实例") ErrInvalidInput = newError("51101", "invalid input parameter", "无效的输入参数") // server ErrKnockApiRequestFailed = newError("52001", "knock api request failed", "敲门api请求失败") ErrAuthServiceProviderNotFound = newError("52002", "failed to find auth service provider", "无法找到服务提供商") ErrACConnectionNotFound = newError("52003", "failed to find ac connection", "无法找到门禁连接") ErrResourceNotFound = newError("52004", "failed to find resource", "无法找到资源") ErrServerACOpsFailed = newError("52005", "server ac operation failed", "服务器请求门禁操作失败") ErrAuthHandlerNotFound = newError("52006", "failed to find auth handler", "无法找到验证处理接口") ErrBackendAuthRequired = newError("52007", "server backend auth required", "服务器需要后端敲门验证") ErrUrlPathInvalid = newError("52008", "client request url path is invalid", "请求路径无效") // ac ErrACOperationFailed = newError("53001", "ac operation failed", "门禁操作失败") ErrACEmptyPassAddress = newError("53002", "pass address is empty", "放行地址为空") ErrACIPSetNotFound = newError("53003", "ipset not found", "无法找到ipset") ErrACIPSetOperationFailed = newError("53004", "ipset operation failed", "ipset操作失败") ErrACTempPortListenFailed = newError("53005", "temporary port listening failed", "临时端口监听失败") ErrACResolveTempPortFailed = newError("53006", "resolve temparory port failed", "解析临时端口失败") // api ErrHttpRequestFailed = newError("54001", "http request failed", "http请求失败") ErrHttpResponseFormatError = newError("54002", "http response format error", "http响应格式错误") ErrHttpReturnedWithError = newError("54003", "http returns with error", "http返回带有错误") ErrHttpResourceAddressNotFound = newError("54004", "http resource address not found", "http无法找到资源地址") )
application errors
View Source
var ErrorMsgLanguageLocale string = "EN"
View Source
var (
ExeDirPath string
)
Functions ¶
func ErrorToErrorCode ¶
func ErrorToString ¶
Types ¶
type ACAccessAckMsg ¶
type ACOnlineMsg ¶
type ACOpsResultMsg ¶
type ACOpsResultMsg struct {
ErrCode string `json:"errCode"`
ErrMsg string `json:"errMsg,omitempty"`
OpenTime uint32 `json:"opnTime"`
ACToken string `json:"token"`
PreAccessAction *PreAccessInfo `json:"preAct"`
}
type ACRefreshMsg ¶ added in v0.4.1
type ACRefreshMsg struct {
NhpToken string `json:"nhpToken"`
SourceAddr *NetAddress `json:"srcAddr"`
}
type AgentAccessMsg ¶
type AgentAccessMsg struct {
UserId string `json:"usrId"`
DeviceId string `json:"devId"`
OrganizationId string `json:"orgId,omitempty"`
ACToken string `json:"acToken"`
UserData map[string]any `json:"usrData,omitempty"`
}
agent <-> ac
type AgentKnockMsg ¶
type AgentKnockMsg struct {
HeaderType int `json:"headerType"`
UserId string `json:"usrId"`
DeviceId string `json:"devId"`
OrganizationId string `json:"orgId,omitempty"`
AuthServiceId string `json:"aspId"`
ResourceId string `json:"resId"`
CheckResults map[string]any `json:"results,omitempty"`
UserData map[string]any `json:"usrData,omitempty"`
}
func (*AgentKnockMsg) Id ¶
func (knkMsg *AgentKnockMsg) Id() string
type AgentListMsg ¶
type AgentOTPMsg ¶
type AgentRegisterMsg ¶
type AuthServiceProviderData ¶
type AuthServiceProviderData struct {
ResourceGroups ResourceGroupMap `json:"ress"`
AuthSvcId string `json:"aspId"`
PluginPath string `json:"pluginPath,omitempty"`
PluginHash string `json:"pluginHash,omitempty"`
}
type AuthSvcProviderMap ¶
type AuthSvcProviderMap map[string]*AuthServiceProviderData
type DAGMsg ¶ added in v0.4.1
type DAGMsg struct {
DoId string `json:"doId"` // Echoes request's DoId
ErrCode int `json:"errCode"` // Authorization error code (0=success)
ErrMsg string `json:"errMsg"` // Error message (empty if success)
WrappedKey string `json:"wrappedKey"` // Base64-encoded symmetric key encrypted with data consumer's public key (empty on error)
}
7.2.4.NHP_DAG (DHP Access Granted)
type DAKMsg ¶ added in v0.4.1
type DAKMsg struct {
DoId string `json:"doId"` // Echoes registration request's DoId
ErrCode int `json:"errCode"` // Registration error code (0=success)
ErrMsg string `json:"errMsg"` // Error message (empty if success)
}
7.2.2.NHP_DAK (DHP Register Ack)
type DARMsg ¶ added in v0.4.1
type DARMsg struct {
DoId string `json:"doId"` // Requested data object identifier
}
7.2.3.NHP_DAR (DHP Access Request)
type DHPKao ¶ added in v0.4.1
type DHPKao struct {
KeyWrapper string `json:"keyWrapper"` // Key wrapping method: "kas"=KAS public key, "consumer"=data consumer's public key
PolicyBinding string `json:"policyBinding"` // Base64-encoded HMAC(HMAC(pao), key) using payload key
ConsumerId string `json:"ConsumerId"` // Data consumer identifier (email/phone/etc)
WrappedKey string `json:"wrappedKey"` // Base64-encoded payload key encrypted via keyWrapper
}
7.3.KAO (Key Access Object)
type DHPPolicy ¶ added in v0.4.1
type DHPPolicy struct {
ConsumerPublicKey string `json:"publicKey"` // Data consumer's public key
ConsumerId string `json:"consumerId"` // Data consumer ID
}
DHP Policy
type DPCMsg ¶ added in v0.4.1
type DPCMsg struct {
DoId string `json:"doId"` // Data object identifier
ChallengeId string `json:"challengeId"` // Challenge ID (must match corresponding NHP_DPC)
ChallengeContent string `json:"challengeContent"` // Policy challenge content
TTL int `json:"TTL"` // Evidence validity period in milliseconds
}
7.2.5.NHP_DPC (DHP Policy Challenge)
type DPVMsg ¶ added in v0.4.1
type DPVMsg struct {
DoId string `json:"doId"` // Data object identifier
ChallengeId string `json:"challengeId"` // Matching challenge ID
Evidence string `json:"evidence"` // Policy verification evidence
TTL int `json:"TTL"` // Evidence validity period in milliseconds
}
7.2.6.NHP_DPV (DHP Policy Verification)
type DRGMsg ¶ added in v0.4.1
type DRGMsg struct {
DoType string `json:"doType"` // Data object format type, default "ZTDO" (ZTDO format details in Chapter 8). Custom formats allowed.
DoId string `json:"doId"` // Globally unique data object identifier (typically UUID)
AccessUrl string `json:"accessUrl"` // Data access URL (empty indicates offline transfer)
AccessByNHP bool `json:"accessByNHP"` // Require NHP handshake before accessing URL (optional if accessUrl empty)
AspHost string `json:"aspHost"` // ASP authorization service provider address (KAS/PAS services)
KasType int `json:"kasType"` // KAS type: 0=KAS on NHP-server (default), 1=KAS on ASP
KaoContent string `json:"kaoContent"` // KAO JSON data when kasType=0 (see 7.3). Empty otherwise.
PasType int `json:"pasType"` // PAS type: 0=PAS on NHP-server (default), 1=PAS on ASP
PaoContent string `json:"paoContent"` // PAO content (REGO policy) when pasType=0 (see 7.4). Empty otherwise.
}
// DHP Msg structs 7.2.1.NHP_DRG (DHP Register)
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func ErrorCodeToError ¶
func (*Error) ErrorNumber ¶ added in v0.4.0
type HttpKnockRequest ¶
type HttpKnockRequest struct {
UserId string `json:"usrId"`
DeviceId string `json:"devId"`
OrganizationId string `json:"orgId,omitempty"`
AuthServiceId string `json:"aspId"`
ResourceId string `json:"resId"`
Token string `json:"token"`
Code string `json:"code"`
DstUrl string `json:"dstUrl"`
Url *url.URL `json:"-"`
UserAgent string `json:"-"`
SrcIp string `json:"-"`
SrcPort int `json:"-"`
}
type HttpRefreshRequest ¶ added in v0.4.1
type LoginPageContext ¶
type LoginPageContext struct {
Title string `json:"title,omitempty"`
ClientId string `json:"clientId,omitempty"`
AppKey string `json:"appKey,omitempty"`
AppSecret string `json:"appSecret,omitempty"`
RedirectUrl string `json:"redirectUrl,omitempty"`
RedirectWithParams bool `json:"redirectWithParams,omitempty"`
}
authsvcprovider and resource
type NetAddress ¶
type NetAddress struct {
Ip string `json:"ip"` // IP address, mandatory
Port int `json:"port,omitempty"` // optional
Protocol string `json:"proto,omitempty"` // tcp/udp/empty for any optional
}
func (*NetAddress) String ¶
func (na *NetAddress) String() string
type NhpAuthRequest ¶
type NhpAuthRequest struct {
Msg *AgentKnockMsg `json:"msg"`
Ack *ServerKnockAckMsg `json:"ack"`
PublicKey string `json:"pubKey"`
SrcAddr *NetAddress `json:"srcAddr"`
}
type NhpListRequest ¶
type NhpListRequest struct {
Msg *AgentListMsg `json:"msg"`
Ack *ServerListResultMsg `json:"ack"`
PublicKey string `json:"pubKey"`
SrcAddr *NetAddress `json:"srcAddr"`
}
type NhpOTPRequest ¶
type NhpOTPRequest struct {
Msg *AgentOTPMsg `json:"msg"`
SrcAddr *NetAddress `json:"srcAddr"`
}
requests
type NhpRegisterRequest ¶
type NhpRegisterRequest struct {
Msg *AgentRegisterMsg `json:"msg"`
Ack *ServerRegisterAckMsg `json:"ack"`
PublicKey string `json:"pubKey"`
SrcAddr *NetAddress `json:"srcAddr"`
}
type PreAccessInfo ¶
type ResourceData ¶
type ResourceData struct {
ResourceGroup `mapstructure:",squash"`
// optional extension data
AppKey string `json:"appKey,omitempty"`
AppSecret string `json:"appSecret,omitempty"`
AccessKey string `json:"accessKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
ExInfo map[string]any `json:"exinfo,omitempty"`
RedirectUrl string `json:"redirectUrl,omitempty"`
RedirectWithParams bool `json:"redirectWithParams,omitempty"`
SkipAuth bool `json:"skipAuth,omitempty"`
CookieDomain string `json:"cookieDomain,omitempty"`
}
type ResourceGroup ¶
type ResourceGroup struct {
AuthServiceId string `json:"aspId"`
ResourceId string `json:"resId"`
OpenTime uint32 `json:"opnTime,omitempty"`
AuthProviderToken string `json:"aspToken,omitempty"`
Resources map[string]*ResourceInfo `json:"resInfo"`
}
func (*ResourceGroup) Hosts ¶
func (r *ResourceGroup) Hosts() map[string]string
func (*ResourceGroup) Id ¶
func (r *ResourceGroup) Id() string
type ResourceGroupMap ¶
type ResourceGroupMap map[string]*ResourceData
type ResourceInfo ¶
type ResourceInfo struct {
ACId string
Hostname string `json:"host,omitempty"` // hostname, optional
Addr *NetAddress `json:"addr"` // dst ip + port + protocol
PortSuffix bool `json:"portSuffix,omitempty"`
}
func (*ResourceInfo) DestHost ¶
func (r *ResourceInfo) DestHost() string
func (*ResourceInfo) DstIp ¶
func (r *ResourceInfo) DstIp() string
type ServerACAckMsg ¶
type ServerACOpsMsg ¶
type ServerACOpsMsg struct {
UserId string `json:"usrId"`
DeviceId string `json:"devId"`
OrganizationId string `json:"orgId,omitempty"`
AuthServiceId string `json:"aspId"`
ResourceId string `json:"resId"`
SourceAddrs []*NetAddress `json:"srcAddrs"`
DestinationAddrs []*NetAddress `json:"dstAddrs"`
OpenTime uint32 `json:"opnTime"`
}
ac <-> server
type ServerCookieMsg ¶
agent <-> server
type ServerKnockAckMsg ¶
type ServerKnockAckMsg struct {
ErrCode string `json:"errCode"`
ErrMsg string `json:"errMsg,omitempty"`
ResourceHost map[string]string `json:"resHost"`
OpenTime uint32 `json:"opnTime"`
AuthProviderToken string `json:"aspToken,omitempty"` // optional for ac backend validation
AgentAddr string `json:"agentAddr"`
ACTokens map[string]string `json:"acTokens"`
PreAccessActions map[string]*PreAccessInfo `json:"preActions,omitempty"` // optional for pre-access
RedirectUrl string `json:"redirectUrl,omitempty"`
}
type ServerListResultMsg ¶
type ServerRegisterAckMsg ¶
Click to show internal directories.
Click to hide internal directories.