proxy

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOCKER_SOCKET = "/var/run/docker.sock"
	PROXY_SOCKET  = "/tmp/doxy.sock"
	PATTERN_FILE  = "/etc/doxy.pattern"
	DEVICE_FILE   = "/etc/doxy.devices"
)

Variables

View Source
var (
	DEF_PAT = []string{
		`^/(v\d\.\d+/)?containers(/\w+)?/(json|stats|top)$`,
		`^/(v\d\.\d+/)?services(/[0-9a-f]+)?$`,
		`^/(v\d\.\d+/)?tasks(/\w+)?$`,
		`^/(v\d\.\d+/)?networks(/\w+)?$`,
		`^/(v\d\.\d+/)?volumes(/\w+)?$`,
		`^/(v\d\.\d+/)?nodes(/\w+)?$`,
		`^/(v\d\.\d+/)?info$`,
		`^/(v\d\.\d+/)?version$`,
		"^/_ping$",
	}
	HPC_PAT = []string{
		`^/(v\d\.\d+/)?containers(/\w+)?/(json|stats|top|create|start|run|kill)$`,
		`^/(v\d\.\d+/)?images(/\w+)?/(json|pull)$`,
		`^/(v\d\.\d+/)?info$`,
		`^/(v\d\.\d+/)?images/(pull|create)$`,
		`^/(v\d\.\d+/)?version$`,
		"^/_ping$",
	}
	DEVICES = []string{
		"/dev/nvidia0:/dev/nvidia0:rwm",
		"/dev/nvidia-uvm:/dev/nvidia-uvm:rwm",
		"/dev/nvidiactl:/dev/nvidiactl:rwm",
	}
	PATTERNS = map[string][]string{
		"default": DEF_PAT,
		"hpc":     HPC_PAT,
	}
)

Functions

func ListenToNewSock

func ListenToNewSock(newsock string, sigc chan os.Signal) (l net.Listener, err error)

func ReadLineFile added in v0.2.1

func ReadLineFile(reader io.Reader) (patterns []string, err error)

Types

type Headers added in v0.2.0

type Headers map[string][]string

type Proxy

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

func NewProxy

func NewProxy(opts ...ProxyOption) Proxy

func (*Proxy) GetOptions added in v0.1.2

func (p *Proxy) GetOptions() map[string]interface{}

func (*Proxy) Run

func (p *Proxy) Run()

type ProxyOption added in v0.1.2

type ProxyOption func(*ProxyOptions)

func WithBindMounts added in v0.2.0

func WithBindMounts(bm []string) ProxyOption

func WithDebugEnabled added in v0.1.2

func WithDebugEnabled() ProxyOption

func WithDebugValue added in v0.1.2

func WithDebugValue(d bool) ProxyOption

func WithDevMappings added in v0.2.0

func WithDevMappings(dm []string) ProxyOption

func WithDockerSocket added in v0.1.2

func WithDockerSocket(s string) ProxyOption

func WithGpuValue added in v0.2.0

func WithGpuValue(b bool) ProxyOption

func WithPattern added in v0.1.2

func WithPattern(p string) ProxyOption

func WithPatterns added in v0.1.2

func WithPatterns(p []string) ProxyOption

func WithPinUserValue added in v0.2.2

func WithPinUserValue(pu string) ProxyOption

func WithProxySocket added in v0.1.2

func WithProxySocket(s string) ProxyOption

type ProxyOptions added in v0.1.2

type ProxyOptions struct {
	DockerSocket string
	ProxySocket  string
	PinUser      string
	Debug, Gpu   bool
	Patterns     []string
	BindMounts   []string
	DevMappings  []string
}

type UnixSocket

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

UnixSocket just provides the path, so that I can test it

func NewUnixSocket

func NewUnixSocket(path string) UnixSocket

NewUnixSocket return a socket using the path

type UpStream

type UpStream struct {
	Name string
	// contains filtered or unexported fields
}

UpStream creates upstream handler struct

func NewUpstream

func NewUpstream(socket string, regs []string, binds []string, devs []string, gpu bool, pinUser string) *UpStream

NewUpstream returns a new socket (magic)

func (*UpStream) ServeHTTP

func (u *UpStream) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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