Documentation ¶
Index ¶
- Variables
- func ErrorToErrorCode(err error) string
- func ErrorToString(err error) string
- type ACAccessAckMsg
- type ACOnlineMsg
- type ACOpsResultMsg
- type AgentAccessMsg
- type AgentKnockMsg
- type AgentListMsg
- type AgentOTPMsg
- type AgentRegisterMsg
- type AuthServiceProviderData
- type AuthSvcProviderMap
- type Error
- type HttpKnockRequest
- 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"` PreAccessAction *PreAccessInfo `json:"preAct"` }
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 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 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"` }
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"` PreAccessActions []*PreAccessInfo `json:"preActs,omitempty"` // optional for pre-access RedirectUrl string `json:"redirectUrl,omitempty"` }
type ServerListResultMsg ¶
type ServerRegisterAckMsg ¶
Click to show internal directories.
Click to hide internal directories.