peersrun

package
v0.182.7 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(ctx context.Context, hubURL, token string) error

Types

type Dependencies

type Dependencies struct {
	ConfigPath    func() string
	Admin         func(context.Context, string) (AdminOperations, error)
	ListenAddress func(string) (string, error)
	Do            func(*http.Request) (*http.Response, error)
	Abs           func(string) (string, error)
}

type DisconnectRequest

type DisconnectRequest struct{ Root, Peer string }

type GetRequest

type GetRequest struct{ Root, Peer string }

type InviteOutput

type InviteOutput struct {
	PeerID    string    `json:"peer_id"`
	Name      string    `json:"name"`
	Token     string    `json:"token,omitempty"`
	TokenFile string    `json:"token_file,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	Rotated   bool      `json:"rotated"`
}

type InviteRequest

type InviteRequest struct {
	Root, Name, TokenFile string
	Rotate                bool
}

type InviteResult

type InviteResult struct {
	Output             InviteOutput
	AttemptedTokenFile string
	TokenWriteError    error
}

type JoinDependencies

type JoinDependencies struct {
	ConfigPath         func() string
	Verify             func(context.Context, string, string) error
	Restart            func(context.Context, string) error
	EnsureNodeIdentity func(string) error
}

type JoinOutput

type JoinOutput struct {
	HubURL        string `json:"hub_url"`
	ConfigPath    string `json:"config_path"`
	TokenFile     string `json:"token_file"`
	Verified      bool   `json:"verified"`
	DaemonRestart bool   `json:"daemon_restart"`
}

type JoinRequest

type JoinRequest struct {
	Root, HubURL, TokenFile   string
	TokenStdin, RestartDaemon bool
}

type ListRequest

type ListRequest struct{ Root string }

type ListResult

type ListResult struct {
	Response peers.ListResponse
	Finding  error
}

type Refusal

type Refusal struct {
	Kind    RefusalKind
	Message string
}

func (*Refusal) Error

func (e *Refusal) Error() string

type RefusalKind

type RefusalKind int
const (
	Usage RefusalKind = iota
	Findings
)

type Service

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

func New

func New(deps Dependencies, join JoinDependencies) Service

func (Service) Disconnect

func (service Service) Disconnect(ctx context.Context, request DisconnectRequest) (peers.DisconnectResponse, error)

func (Service) Get

func (service Service) Get(ctx context.Context, request GetRequest) (peers.Detail, error)

func (Service) Invite

func (service Service) Invite(ctx context.Context, request InviteRequest) (InviteResult, error)

func (Service) Join

func (service Service) Join(ctx context.Context, request JoinRequest, in io.Reader, warn func(error)) (JoinOutput, error)

func (Service) List

func (service Service) List(ctx context.Context, request ListRequest, warn func(error)) (ListResult, error)

func (Service) TrustChange

func (service Service) TrustChange(ctx context.Context, request TrustRequest) (TrustResult, error)

type TrustAction

type TrustAction int
const (
	Block TrustAction = iota
	Unblock
)

type TrustRequest

type TrustRequest struct {
	Root, Peer string
	Action     TrustAction
}

type TrustResult

type TrustResult struct {
	Response peers.TrustResponse
	Upstream bool
}

Jump to

Keyboard shortcuts

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