handler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FlowBidirectString = "bidirect"

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	time.Duration
}

Duration is used strictly for JSON requests/responses due to duration marshalling issues

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type GroupPeerResponse

type GroupPeerResponse struct {
	Key  string
	Name string
}

GroupPeerResponse is a response sent to the client

type GroupRequest

type GroupRequest struct {
	ID    string
	Name  string
	Peers []string
}

GroupRequest to create or update group

type GroupResponse

type GroupResponse struct {
	ID    string
	Name  string
	Peers []GroupPeerResponse `json:",omitempty"`
}

GroupResponse is a response sent to the client

type Groups

type Groups struct {
	// contains filtered or unexported fields
}

Groups is a handler that returns groups of the account

func NewGroups

func NewGroups(accountManager server.AccountManager, authAudience string) *Groups

func (*Groups) CreateOrUpdateGroupHandler

func (h *Groups) CreateOrUpdateGroupHandler(w http.ResponseWriter, r *http.Request)

func (*Groups) DeleteGroupHandler

func (h *Groups) DeleteGroupHandler(w http.ResponseWriter, r *http.Request)

func (*Groups) GetAllGroupsHandler

func (h *Groups) GetAllGroupsHandler(w http.ResponseWriter, r *http.Request)

GetAllGroupsHandler list for the account

func (*Groups) GetGroupHandler

func (h *Groups) GetGroupHandler(w http.ResponseWriter, r *http.Request)

type PeerRequest

type PeerRequest struct {
	Name string
}

PeerRequest is a request sent by the client

type PeerResponse

type PeerResponse struct {
	Name      string
	IP        string
	Connected bool
	LastSeen  time.Time
	OS        string
	Version   string
}

PeerResponse is a response sent to the client

type Peers

type Peers struct {
	// contains filtered or unexported fields
}

Peers is a handler that returns peers of the account

func NewPeers

func NewPeers(accountManager server.AccountManager, authAudience string) *Peers

func (*Peers) GetPeers

func (h *Peers) GetPeers(w http.ResponseWriter, r *http.Request)

func (*Peers) HandlePeer

func (h *Peers) HandlePeer(w http.ResponseWriter, r *http.Request)

type RuleGroupResponse

type RuleGroupResponse struct {
	ID         string
	Name       string
	PeersCount int
}

RuleGroupResponse is a response sent to the client

type RuleRequest

type RuleRequest struct {
	ID          string
	Name        string
	Source      []string
	Destination []string
	Flow        string
}

RuleRequest to create or update rule

type RuleResponse

type RuleResponse struct {
	ID          string
	Name        string
	Source      []RuleGroupResponse
	Destination []RuleGroupResponse
	Flow        string
}

RuleResponse is a response sent to the client

type Rules

type Rules struct {
	// contains filtered or unexported fields
}

Rules is a handler that returns rules of the account

func NewRules

func NewRules(accountManager server.AccountManager, authAudience string) *Rules

func (*Rules) CreateOrUpdateRuleHandler

func (h *Rules) CreateOrUpdateRuleHandler(w http.ResponseWriter, r *http.Request)

func (*Rules) DeleteRuleHandler

func (h *Rules) DeleteRuleHandler(w http.ResponseWriter, r *http.Request)

func (*Rules) GetAllRulesHandler

func (h *Rules) GetAllRulesHandler(w http.ResponseWriter, r *http.Request)

GetAllRulesHandler list for the account

func (*Rules) GetRuleHandler

func (h *Rules) GetRuleHandler(w http.ResponseWriter, r *http.Request)

type SetupKeyRequest

type SetupKeyRequest struct {
	Name      string
	Type      server.SetupKeyType
	ExpiresIn *util.Duration
	Revoked   bool
}

SetupKeyRequest is a request sent by client. This object contains fields that can be modified

type SetupKeyResponse

type SetupKeyResponse struct {
	Id        string
	Key       string
	Name      string
	Expires   time.Time
	Type      server.SetupKeyType
	Valid     bool
	Revoked   bool
	UsedTimes int
	LastUsed  time.Time
	State     string
}

SetupKeyResponse is a response sent to the client

type SetupKeys

type SetupKeys struct {
	// contains filtered or unexported fields
}

SetupKeys is a handler that returns a list of setup keys of the account

func NewSetupKeysHandler

func NewSetupKeysHandler(accountManager server.AccountManager, authAudience string) *SetupKeys

func (*SetupKeys) GetKeys

func (h *SetupKeys) GetKeys(w http.ResponseWriter, r *http.Request)

func (*SetupKeys) HandleKey

func (h *SetupKeys) HandleKey(w http.ResponseWriter, r *http.Request)

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

func NewUserHandler

func NewUserHandler(accountManager server.AccountManager, authAudience string) *UserHandler

func (*UserHandler) GetUsers

func (u *UserHandler) GetUsers(w http.ResponseWriter, r *http.Request)

GetUsers returns a list of users of the account this user belongs to. It also gathers additional user data (like email and name) from the IDP manager.

type UserResponse

type UserResponse struct {
	ID    string `json:"id"`
	Email string `json:"email"`
	Name  string `json:"name"`
	Role  string `json:"role"`
}

Jump to

Keyboard shortcuts

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