netapi

package
v0.0.0-...-2e0ef96 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeRequest = "request"
	MsgTypeReply   = "reply"
	MsgTypeNotice  = "notice"
)
View Source
const (
	ReqTypeAddAccessReq = "add_access_req"

	ReqTypeAuth = "auth"

	ReqTypeListAccessReqs = "list_access_reqs"
	ReqTypeDelAccessReq   = "del_access_req"

	ReqTypeAddUser         = "add_user"
	ReqTypeUpdateUser      = "update_user"
	ReqTypeChangePassword  = "change_password"
	ReqTypeListUsers       = "list_user"
	ReqTypeGetAuthUserData = "get_auth_user_data"
	ReqTypeDelUser         = "del_user"

	ReqTypeAddNode          = "add_node"
	ReqTypeUpdateNode       = "update_node"
	ReqTypeListNodes        = "list_nodes"
	ReqTypeFindInNodesCache = "find_in_nodes_cache"
	ReqTypeDelNode          = "del_node"

	ReqTypeGetDirConnSettings = "get_dir_conn_settings"
	ReqTypePassKeyPassword    = "pass_key_password"
)
View Source
const (
	ReqResultStatusFailed     = "failed"
	ReqResultStatusSuccessful = "successful"
)
View Source
const (
	ReqResultReasonEmpty               = ""
	ReqResultReasonUnsupportedReq      = "Unsupported request"
	ReqResultReasonInvalidInputData    = "Invalid input data"
	ReqResultReasonInternalError       = "Internal error"
	ReqResultReasonAccessDenied        = "Access denied"
	ReqResultReasonInvalidSignature    = "Invalid signature"
	ReqResultReasonAlreadyExist        = "Already exist"
	ReqResultReasonNotFound            = "Not found"
	ReqResultReasonPasswordTooSimple   = "Password too simple"
	ReqResultReasonKeyPasswordRequired = "Key password required"
)
View Source
const (
	NoticeTypeNoop         = "noop"
	NoticeTypeUpdatedUsers = "updated_users"
	NoticeTypeUpdatedNodes = "updated_nodes"
)

Variables

This section is empty.

Functions

func BuildNotice

func BuildNotice(noticeType string) ([]byte, error)

For parse notice use ParseMsgHeader

func BuildRepAuthStageOne

func BuildRepAuthStageOne(questionIn []byte) ([]byte, error)

func BuildRepFindInNodesCache

func BuildRepFindInNodesCache(nodesIn []data.NodeAuth) ([]byte, error)

func BuildRepGetAuthUserData

func BuildRepGetAuthUserData(userIn *data.UserAuth) ([]byte, error)

func BuildRepGetDirConnSettings

func BuildRepGetDirConnSettings(dirConnSettingsIn *data.DirConnSettings) ([]byte, error)

func BuildRepListAccessReqs

func BuildRepListAccessReqs(accessReqsIn []data.AccessReqDB) ([]byte, error)

func BuildRepListNodes

func BuildRepListNodes(nodesIn []data.NodeDB) ([]byte, error)

func BuildRepListUsers

func BuildRepListUsers(usersIn []data.UserDB) ([]byte, error)

func BuildReqAddAccessReq

func BuildReqAddAccessReq(accessReqIn *data.AccessReq, secret string) ([]byte, error)

func BuildReqAddNode

func BuildReqAddNode(nodeIn *data.NodeDB) ([]byte, error)

func BuildReqAddUser

func BuildReqAddUser(userIn *data.UserDB) ([]byte, error)

func BuildReqAuthStageOne

func BuildReqAuthStageOne(esamPubKeyIn *data.ESAMPubKey, noticesNotRequired bool) ([]byte, error)

func BuildReqAuthStageTwo

func BuildReqAuthStageTwo(answerIn []byte) ([]byte, error)

func BuildReqChangePassword

func BuildReqChangePassword(password string, passwordHash string, passwordHashSign []byte) ([]byte, error)

func BuildReqDelAccessReq

func BuildReqDelAccessReq(esamPubKeyIn *data.ESAMPubKey) ([]byte, error)

func BuildReqDelNode

func BuildReqDelNode(esamPubKeyIn *data.ESAMPubKey) ([]byte, error)

func BuildReqDelUser

func BuildReqDelUser(esamPubKeyIn *data.ESAMPubKey) ([]byte, error)

func BuildReqFindInNodesCache

func BuildReqFindInNodesCache(nodeFilterIn *data.NodeAuth, fullMatch bool) ([]byte, error)

func BuildReqListAccessReqs

func BuildReqListAccessReqs(accessReqFilterIn *data.AccessReqDB) ([]byte, error)

func BuildReqListNodes

func BuildReqListNodes(nodeFilterIn *data.Node) ([]byte, error)

func BuildReqListUsers

func BuildReqListUsers(userFilterIn *data.User) ([]byte, error)

func BuildReqPassKeyPassword

func BuildReqPassKeyPassword(password string) ([]byte, error)

func BuildReqUpdateNode

func BuildReqUpdateNode(esamPubKeyIn *data.ESAMPubKey, nodeIn *data.NodeDB) ([]byte, error)

func BuildReqUpdateUser

func BuildReqUpdateUser(esamPubKeyIn *data.ESAMPubKey, userIn *data.UserDB) ([]byte, error)

func BuildSimpleRep

func BuildSimpleRep(reqType string, reqResultIn *ReqResult) ([]byte, error)

func BuildSimpleReq

func BuildSimpleReq(reqType string) ([]byte, error)

Suitable for:

  • ReqTypeGetDirConnSettings

  • ReqTypeGetAuthUserData

    For parse request use ParseMsgHeader

func BuildUnsupportedMsg

func BuildUnsupportedMsg() ([]byte, error)

func ParseMsgHeader

func ParseMsgHeader(jsonIn []byte, msgHeaderOut *MsgHeader) error

func ParseRepAuthStageOne

func ParseRepAuthStageOne(jsonIn []byte) ([]byte, error)

func ParseRepFindInNodesCache

func ParseRepFindInNodesCache(jsonIn []byte) ([]data.NodeAuth, error)

func ParseRepGetAuthUserData

func ParseRepGetAuthUserData(jsonIn []byte, userOut *data.UserAuth) error

func ParseRepGetDirConnSettings

func ParseRepGetDirConnSettings(jsonIn []byte, dirConnSettingsOut *data.DirConnSettings) error

func ParseRepListAccessReqs

func ParseRepListAccessReqs(jsonIn []byte) ([]data.AccessReqDB, error)

func ParseRepListNodes

func ParseRepListNodes(jsonIn []byte) ([]data.NodeDB, error)

func ParseRepListUsers

func ParseRepListUsers(jsonIn []byte) ([]data.UserDB, error)

func ParseReqAddAccessReq

func ParseReqAddAccessReq(jsonIn []byte, accessReqOut *data.AccessReq, secret *string) error

func ParseReqAddNode

func ParseReqAddNode(jsonIn []byte, nodeOut *data.NodeDB) error

func ParseReqAddUser

func ParseReqAddUser(jsonIn []byte, userOut *data.UserDB) error

func ParseReqAuthStageOne

func ParseReqAuthStageOne(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey) (bool, error)

func ParseReqAuthStageTwo

func ParseReqAuthStageTwo(jsonIn []byte) ([]byte, error)

func ParseReqChangePassword

func ParseReqChangePassword(jsonIn []byte) (string, string, []byte, error)

func ParseReqDelAccessReq

func ParseReqDelAccessReq(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey) error

func ParseReqDelNode

func ParseReqDelNode(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey) error

func ParseReqDelUser

func ParseReqDelUser(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey) error

func ParseReqFindInNodesCache

func ParseReqFindInNodesCache(jsonIn []byte, nodeFilterOut *data.NodeAuth, fullMatchOut *bool) error

func ParseReqListAccessReqs

func ParseReqListAccessReqs(jsonIn []byte, accessReqFilterOut *data.AccessReqDB) error

func ParseReqListNodes

func ParseReqListNodes(jsonIn []byte, nodeFilterOut *data.Node) error

func ParseReqListUsers

func ParseReqListUsers(jsonIn []byte, userFilterOut *data.User) error

func ParseReqPassKeyPassword

func ParseReqPassKeyPassword(jsonIn []byte) (string, error)

func ParseReqResult

func ParseReqResult(jsonIn []byte, reqResultOut *ReqResult) error

func ParseReqUpdateNode

func ParseReqUpdateNode(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey, nodeOut *data.NodeDB) error

func ParseReqUpdateUser

func ParseReqUpdateUser(jsonIn []byte, esamPubKeyOut *data.ESAMPubKey, userOut *data.UserDB) error

func TestMsgSubType

func TestMsgSubType(subType string) error

func TestMsgType

func TestMsgType(msgType string) error

func TestNoticeType

func TestNoticeType(noticeType string) error

func TestReqResultStatus

func TestReqResultStatus(reqResultStatus string) error

func TestReqType

func TestReqType(requestType string) error

Types

type MsgHeader

type MsgHeader struct {
	Type    string `json:"type"`
	SubType string `json:"subtype"`
}

func (*MsgHeader) Test

func (msgHeader *MsgHeader) Test() error

type ReqResult

type ReqResult struct {
	Status string `json:"status"`
	Reason string `json:"reason"`
}

func (*ReqResult) Test

func (reqResult *ReqResult) Test() error

Jump to

Keyboard shortcuts

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