v0.0.0-...-2bcf2af Latest Latest

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

Go to latest
Published: Aug 8, 2023 License: GPL-3.0 Imports: 22 Imported by: 0



docker contains functions to handle docker containers related to the OpenVPN and Bridge services.



This section is empty.


View Source
var (
	// Container names will break when we have >1 container running for each type
	ContainerNameVPN     = "openvpn"
	ContainerNameMenshen = "menshen"
	ContainerNameBridge  = "obfsvpn"

	NetworkName = "vpn-net"
View Source
var (
	HostName = "localhost"
View Source
var (
	// Timeout for stopping/removing, in seconds.
	Timeout = 10


func CreateVolume

func CreateVolume()

func GenerateClientCert

func GenerateClientCert() []byte

func GetLogs

func GetLogs(ctx context.Context, cli *client.Client, contName string) (logOutput io.ReadCloser)

GetLogs return logs from the container io.ReadCloser. It's the caller duty to do a stdcopy.StdCopy. Any other method might render unknown unicode character as log output has both stdout and stderr. That starting has info if that line is stderr or stdout.

func InitPKI

func InitPKI()

func PullImages

func PullImages()

func RunCmdInContainer

func RunCmdInContainer(img string, net *network.NetworkingConfig, cmd []string, cfg *CmdConfig, bufOut io.ReadWriter)

RunCmdInContainer executes the passed command in the specified container.

func RunVPN

func RunVPN()

func StopContainer

func StopContainer(containerName string, remove bool)

func StopVPN

func StopVPN()


type CmdConfig

type CmdConfig struct {
	ContainerName string
	Detach        bool
	ExposedPorts  []string
	Interactive   bool
	Env           []string
	EnvFile       string
	NetAdmin      bool
	PortBindings  []string
	Silent        bool

Jump to

Keyboard shortcuts

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