cloudflared

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 20 Imported by: 0

README

POSH cloudflared provider

Usage

Plugin
package plugin

type Plugin struct {
  l           log.Logger
  cloudflared *cloudflared.Cloudflared
  commands    command.Commands
}

func New(l log.Logger) (plugin.Plugin, error) {
  inst := &Plugin{
    l:        l,
    commands: command.Commands{},
  }

  // ...

  inst.cloudflared, err = cloudflared.New(l)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create cloudflared")
  }

  // ...
  inst.commands.Add(command.NewCheck(l,
    cloudflared.AcccessChecker(inst.cloudflared, ints.cloudflared.Config().GetAccess("my-access")),
  ))

  inst.commands.MustAdd(cloudflared.NewCommand(l, inst.cloudflared))

  // ...

  return inst, nil
}

Config
cloudflared:
  path: devops/config/cloudflared
  access:
    my-access:
      type: tcp
      port: 1234
      hostname: cloudflared.my-domain.com
Ownbrew
ownbrew:
  packages:
    - name: cloudflared
      tap: foomo/tap/cloudflare/cloudflared
      version: 2024.6.1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessChecker

func AccessChecker(cf *Cloudflared, access Access) check.Checker

Types

type Access

type Access struct {
	Type     string `yaml:"type"`
	Hostname string `yaml:"hostname"`
	Port     int    `yaml:"port"`
}

type Cloudflared

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

func New

func New(l log.Logger, opts ...Option) (*Cloudflared, error)

New command

func (*Cloudflared) Config

func (t *Cloudflared) Config() Config

func (*Cloudflared) Connect

func (t *Cloudflared) Connect(ctx context.Context, access Access) error

func (*Cloudflared) Disonnect

func (t *Cloudflared) Disonnect(ctx context.Context, access Access) error

func (*Cloudflared) IsConnected

func (t *Cloudflared) IsConnected(ctx context.Context, access Access) bool

func (*Cloudflared) List

func (t *Cloudflared) List() ([]Process, error)

type Command

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

func NewCommand

func NewCommand(l log.Logger, cloudflared *Cloudflared, opts ...CommandOption) (*Command, error)

func (*Command) Complete

func (c *Command) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest

func (*Command) Description

func (c *Command) Description() string

func (*Command) Execute

func (c *Command) Execute(ctx context.Context, r *readline.Readline) error

func (*Command) Help

func (c *Command) Help(ctx context.Context, r *readline.Readline) string

func (*Command) Name

func (c *Command) Name() string

func (*Command) Validate

func (c *Command) Validate(ctx context.Context, r *readline.Readline) error

type CommandOption

type CommandOption func(*Command)

func CommandWithName

func CommandWithName(v string) CommandOption

type Config

type Config struct {
	Path   string            `yaml:"path"`
	Access map[string]Access `yaml:"access"`
}

func (Config) AccessNames

func (c Config) AccessNames() []string

func (Config) GetAccesss

func (c Config) GetAccesss(name string) Access

type Option

type Option func(*Cloudflared) error

func WithConfigKey

func WithConfigKey(v string) Option

type Process

type Process struct {
	PID     string
	Exe     string
	Cmdline string
}

Jump to

Keyboard shortcuts

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