handle_net

package
v2.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpCodeOCReserved           OpCode = 0
	OpCodeOCResolution                = 1   // 1 Handle query
	OpCodeOCGetSiteInfo               = 2   // 2 Get HS_SITE values
	OpCodeOCCreateHandle              = 100 // 100 Create new handle
	OpCodeOCDeleteHandle              = 101 // 101 Delete existing handle
	OpCodeOCAddValue                  = 102 // 102 Add handle value(s)
	OpCodeOCRemoveValue               = 103 // 103 Remove handle value(s)
	OpCodeOCModifyValue               = 104 // 104 Modify handle value(s)
	OpCodeOCListHandle                = 105 // 105 List handles
	OpCodeOCListNA                    = 106 // 106 List sub-naming authorities
	OpCodeOCChallengeResponse         = 200 // 200 Response to challenge
	OpCodeOCVerifyResponse            = 201 // 201 Verify challenge response
	OpCodeOCSessionSetup              = 400 // 400 Session setup request
	OpCodeOCSessionTerminate          = 401 // 401 Session termination request
	OpCodeOCSessionExchangeKey        = 402 // 402 Session key exchange
)
View Source
const (
	RCReserved           ResponseCode = 0   // 0 Reserved for request
	RCSuccess                         = 1   // 1 Success response
	RCError                           = 2   // 2 General error
	RcServerBusy                      = 3   // 3 Server too busy to respond
	RcProtocolError                   = 4   // 4 Corrupted or unrecognizable message
	RcOperationDenied                 = 5   // 5 Unsupported operation
	RcRecurLimitExceeded              = 6   // 6 Too many recursions for the request
	RcHandleNotFound                  = 100 // 100 Handle not found
	RcHandleAlreadyExist              = 101 // 101 Handle already exists
	RcInvalidHandle                   = 102 // 102 Encoding (or syntax) error
	RcValueNotFound                   = 200 // 200 Value not found
	RcValueAlreadyExist               = 201 // 201 Value already exists
	RcValueInvalid                    = 202 // 202 Invalid handle value
	RcExpiredSiteInfo                 = 300 // 300 SITE_INFO out of date
	RcServerNotResp                   = 301 // 301 Server not responsible
	RcServiceReferral                 = 302 // 302 Server referral
	RcNaDelegate                      = 303 // 303 Naming authority delegation takes place.
	RcNotAuthorized                   = 400 // 400 Not authorized/permitted
	RcAccessDenied                    = 401 // 401 No access to data
	RcAuthenNeeded                    = 402 // 402 Authentication required
	RcAuthenFailed                    = 403 // 403 Failed to authenticate
	RcInvalidCredential               = 404 // 404 Invalid credential
	RcAuthenTimeout                   = 405 // 405 Authentication timed out
	RcUnableToAuthen                  = 406 // 406 Unable to authenticate
	RcSessionTimeout                  = 500 // 500 Session expired
	RcSessionFailed                   = 501 // 501 Unable to establish session
	RcNoSessionKey                    = 502 // 502 No session yet available
	RcSessionNoSupport                = 503 // 503 Session not supported
	RcSessionKeyInvalid               = 504 // 504 Invalid session key
	RcTrying                          = 900 // 900 Request under processing
	RcForwarded                       = 901 // 901 Request forwarded to another server
	RcQueued                          = 902 // 902 Request queued for later processing
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyDigest

type BodyDigest struct {
	Type   BodyDigestType
	Digest []byte
}

func (*BodyDigest) MarshalHandleBinary

func (d *BodyDigest) MarshalHandleBinary() ([]byte, error)

func (*BodyDigest) Size

func (d *BodyDigest) Size() uint32

func (*BodyDigest) UnmarshalHandleBinary

func (d *BodyDigest) UnmarshalHandleBinary(data []byte) error

type BodyDigestType

type BodyDigestType uint8
const (
	BodyDigestTypeNone BodyDigestType = 0
	BodyDigestTypeMD5  BodyDigestType = 1
	BodyDigestTypeSHA1 BodyDigestType = 2
)

type BodyQueryRequest

type BodyQueryRequest struct {
	Handle UTF8String
	Index  IndexList
	Type   TypeList
}

func (*BodyQueryRequest) MarshalHandleBinary

func (b *BodyQueryRequest) MarshalHandleBinary() ([]byte, error)

func (*BodyQueryRequest) Size

func (b *BodyQueryRequest) Size() uint32

func (*BodyQueryRequest) UnmarshalHandleBinary

func (b *BodyQueryRequest) UnmarshalHandleBinary(data []byte) error

type Credential

type Credential struct {
	Version       uint8
	Reserved      uint8
	Options       [2]byte
	Unimplemented []byte
}

func (*Credential) GetLength

func (c *Credential) GetLength() uint32

func (*Credential) MarshalHandleBinary

func (c *Credential) MarshalHandleBinary() ([]byte, error)

func (*Credential) UnmarshalHandleBinary

func (c *Credential) UnmarshalHandleBinary(data []byte) error

type HandleBinaryMarshaler

type HandleBinaryMarshaler interface {
	MarshalHandleBinary() ([]byte, error)
	UnmarshalHandleBinary([]byte) error
}

type HandleServer

type HandleServer struct {
	Prefixes []string
	// contains filtered or unexported fields
}

func NewHandleServer

func NewHandleServer(prefixes []string) (*HandleServer, error)

func (*HandleServer) RegisterFunction

func (srv *HandleServer) RegisterFunction(op OpCode, f OpFunc)

func (*HandleServer) Serve

func (srv *HandleServer) Serve()

func (*HandleServer) Start

func (srv *HandleServer) Start(protocol, addr string) error

func (*HandleServer) Stop

func (srv *HandleServer) Stop() error

type IndexList

type IndexList []byte

func (*IndexList) MarshalHandleBinary

func (i *IndexList) MarshalHandleBinary() ([]byte, error)

func (*IndexList) Size

func (i *IndexList) Size() uint32

func (*IndexList) UnmarshalHandleBinary

func (i *IndexList) UnmarshalHandleBinary(data []byte) error

type Message

type Message struct {
	Envelope         MessageEnvelope
	Header           MessageHeader
	Body             MessageBody
	CredentialLength uint32
	Credential       Credential
}

func (*Message) MarshalHandleBinary

func (m *Message) MarshalHandleBinary() ([]byte, error)

func (*Message) SetSizes

func (m *Message) SetSizes()

func (*Message) UnmarshalHandleBinary

func (m *Message) UnmarshalHandleBinary(data []byte) error

type MessageBody

type MessageBody struct {
	Digest  *BodyDigest
	Data    []byte
	Request *BodyQueryRequest
}

func (*MessageBody) GetData

func (b *MessageBody) GetData(hasDigest bool) ([]byte, error)

func (*MessageBody) SetData

func (b *MessageBody) SetData(data []byte, hasDigest bool, op OpCode) error

func (*MessageBody) Size

func (b *MessageBody) Size() uint32

type MessageEnvelope

type MessageEnvelope struct {
	MajorVersion   uint8
	MinorVersion   uint8
	MessageFlag    MessageFlag
	SessionId      uint32
	RequestId      uint32
	SequenceNumber uint32
	MessageLength  uint32
}

func (*MessageEnvelope) MarshalHandleBinary

func (env *MessageEnvelope) MarshalHandleBinary() ([]byte, error)

func (*MessageEnvelope) UnmarshalHandleBinary

func (env *MessageEnvelope) UnmarshalHandleBinary(data []byte) error

type MessageFlag

type MessageFlag struct {
	CP,
	EC,
	TC bool
}

func (*MessageFlag) MarshalHandleBinary

func (mf *MessageFlag) MarshalHandleBinary() ([]byte, error)

func (*MessageFlag) UnmarshalHandleBinary

func (mf *MessageFlag) UnmarshalHandleBinary(data []byte) error

type MessageHeader

type MessageHeader struct {
	OpCode               OpCode
	ResponseCode         ResponseCode
	OpFlag               OpFlag
	SiteInfoSerialNumber uint16
	RecursionCount       uint8

	ExpirationTime uint32
	BodyLength     uint32
	// contains filtered or unexported fields
}

func (*MessageHeader) MarshalHandleBinary

func (h *MessageHeader) MarshalHandleBinary() ([]byte, error)

func (*MessageHeader) Size

func (h *MessageHeader) Size() uint32

func (*MessageHeader) UnmarshalHandleBinary

func (h *MessageHeader) UnmarshalHandleBinary(data []byte) error

type OpCode

type OpCode uint32

type OpFlag

type OpFlag struct {
	AT,
	CT,
	ENC,
	REC,
	CA,
	CN,
	KC,
	PO,
	RD bool
}

func (*OpFlag) MarshalHandleBinary

func (of *OpFlag) MarshalHandleBinary() ([]byte, error)

func (*OpFlag) Size

func (of *OpFlag) Size() uint

func (*OpFlag) UnmarshalHandleBinary

func (of *OpFlag) UnmarshalHandleBinary(data []byte) error

type OpFunc

type OpFunc func(*Message) (*Message, error)

type ResponseCode

type ResponseCode uint32

type TypeList

type TypeList []UTF8String

func (*TypeList) MarshalHandleBinary

func (t *TypeList) MarshalHandleBinary() ([]byte, error)

func (*TypeList) Size

func (t *TypeList) Size() uint32

func (*TypeList) UnmarshalHandleBinary

func (t *TypeList) UnmarshalHandleBinary(data []byte) error

type UTF8String

type UTF8String string

func (*UTF8String) MarshalHandleBinary

func (s *UTF8String) MarshalHandleBinary() ([]byte, error)

func (*UTF8String) Size

func (s *UTF8String) Size() uint32

func (*UTF8String) UnmarshalHandleBinary

func (s *UTF8String) UnmarshalHandleBinary(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL