tinybastion

package module
v0.0.0-...-e5c9b1b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

tinybastion

build note: requires go 1.18, which is in beta at the time of writing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bastion

type Bastion struct {
	Config *Config
	Client *wgctrl.Client
	// contains filtered or unexported fields
}

func New

func New(c Config) (*Bastion, error)

func (*Bastion) AddPeer

func (b *Bastion) AddPeer(key wgtypes.Key) (*wgtypes.PeerConfig, error)

func (*Bastion) CleanupPeers

func (b *Bastion) CleanupPeers() error

func (*Bastion) Destroy

func (b *Bastion) Destroy() error

func (*Bastion) ServerInfo

func (b *Bastion) ServerInfo() BastionServerInfo

type BastionServerInfo

type BastionServerInfo struct {
	EndpointHost string
	EndpointPort int
	GatewayIP    string
	PublicKey    string
}

type Config

type Config struct {
	DeviceName          string
	Port                int
	PersistentKeepalive int
	ExternalHostname    string
	CIDR                string
}

type CreateTunnelRequest

type CreateTunnelRequest struct {
	PublicKey *MarshallableKey `json:"public_key"`
}

type CreateTunnelResponse

type CreateTunnelResponse struct {
	PeerConfig *MarshallablePeerConfig
}

type MarshallableKey

type MarshallableKey struct {
	K wgtypes.Key
}

func (*MarshallableKey) MarshalJSON

func (m *MarshallableKey) MarshalJSON() ([]byte, error)

func (*MarshallableKey) UnmarshalJSON

func (m *MarshallableKey) UnmarshalJSON(bytes []byte) error

type MarshallablePeerConfig

type MarshallablePeerConfig struct {
	P   wgtypes.PeerConfig
	BSI BastionServerInfo
}

func (*MarshallablePeerConfig) MarshalJSON

func (m *MarshallablePeerConfig) MarshalJSON() ([]byte, error)

func (*MarshallablePeerConfig) UnmarshalJSON

func (m *MarshallablePeerConfig) UnmarshalJSON(bytes []byte) error

type Server

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

func NewServer

func NewServer(ctx context.Context, tb *Bastion, listenPort int, issuer string) *Server

func (*Server) Destroy

func (s *Server) Destroy() error

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd
tinybastion command
tinyclient command
internal

Jump to

Keyboard shortcuts

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