hub

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright © 2023 Harry C <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2023 Harry C <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	PathJoin   = "/v1/agent/join"
	PathAccept = "/v1/agent/accept"
	PathSubmit = "/v1/agent/submit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog added in v1.1.7

type Catalog interface {
	GetHardwareInfo(agentID int) *hwinfo.HWInfo
	SetHardwareInfo(agentID int, hwInfo *hwinfo.HWInfo)
}

type ConnectionInfo added in v1.1.0

type ConnectionInfo struct {
	AgentID      int
	Since        time.Time
	AgentName    string
	ScopePaths   []string
	Scopes       []string
	Processing   bool
	HardwareInfo *hwinfo.HWInfo
}

type HubServer

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

Hub server is responsible for: 1. Manage agents' connections 2. Forward applications' request to the right agent

func NewHubServer

func NewHubServer(secret string, opts ...HubServerOption) *HubServer

func (*HubServer) GetConnectionsInfos added in v1.1.0

func (hs *HubServer) GetConnectionsInfos() []*ConnectionInfo

func (*HubServer) ServeHTTP

func (hs *HubServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HubServerOption

type HubServerOption func(hs *HubServer)

func WithAppPassword added in v1.1.1

func WithAppPassword(password string) HubServerOption

func WithCatalog added in v1.1.7

func WithCatalog(c Catalog) HubServerOption

func WithConcurrent

func WithConcurrent(n int) HubServerOption

type MemoryCatalog added in v1.1.7

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

func NewMemoryCatalog added in v1.1.7

func NewMemoryCatalog() *MemoryCatalog

func (*MemoryCatalog) GetHardwareInfo added in v1.1.7

func (mc *MemoryCatalog) GetHardwareInfo(agentID int) *hwinfo.HWInfo

func (*MemoryCatalog) SetHardwareInfo added in v1.1.7

func (mc *MemoryCatalog) SetHardwareInfo(agentID int, hwInfo *hwinfo.HWInfo)

type TokenManager

type TokenManager interface {
	Encrypt(*token.AgentToken) (string, error)
	Decrypt(string) (*token.AgentToken, error)
}

Jump to

Keyboard shortcuts

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