client

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package client provides go bindings for gvisor-tap-vsock HTTP API This API is accessible over the endpoint specified with the `--services` or `--listen` arguments to `gvproxy`

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(client *http.Client, base string) *Client

New returns a new instance of a Client. client will be used for the HTTP communication, and base specifies the base path the HTTP API is available at.

func (*Client) AddDNS added in v0.6.2

func (c *Client) AddDNS(req *types.Zone) error

AddDNS adds a new DNS zone to the built-in DNS server

Request: POST /services/dns/add {"Name":"test.internal.","Records":[{"Name":"gateway","IP":"192.168.127.1"}]} Response: HTTP Status Code

func (*Client) Expose

func (c *Client) Expose(req *types.ExposeRequest) error

Expose forwards a new port between host and guest

Request: POST /services/forwarder/expose {"local":"127.0.0.1:2224","remote":"192.168.127.2:22","protocol":"tcp"} Response: HTTP Status Code

func (*Client) List

func (c *Client) List() ([]types.ExposeRequest, error)

List lists all the forwarded ports between host and guest

Request: GET /services/forwarder/all Response: [{"local":"127.0.0.1:2223","remote":"192.168.127.2:22","protocol":"tcp"}]

func (*Client) ListDHCPLeases added in v0.8.8

func (c *Client) ListDHCPLeases() (map[string]string, error)

ListDHCPLeases shows the configuration of the built-in DNS server

Request: GET /services/dhcp/leases Response: {"192.168.127.1":"5a:94:ef:e4:0c:dd","192.168.127.2":"5a:94:ef:e4:0c:ee"}

func (*Client) ListDNS added in v0.6.2

func (c *Client) ListDNS() ([]types.Zone, error)

ListDNS shows the configuration of the built-in DNS server

Request: GET /services/dns/all Response: [{"Name":"containers.internal.","Records":[{"Name":"gateway","IP":"192.168.127.1","Regexp":null},{"Name":"host","IP":"192.168.127.254","Regexp":null}],"DefaultIP":""},{"Name":"docker.internal.","Records":[{"Name":"gateway","IP":"192.168.127.1","Regexp":null},{"Name":"host","IP":"192.168.127.254","Regexp":null}],"DefaultIP":""}]

func (*Client) Unexpose

func (c *Client) Unexpose(req *types.UnexposeRequest) error

Unexpose stops forwarding a port between host and guest

Request: POST /services/forwarder/unexpose {"local":"127.0.0.1:2224","protocol":"tcp"} Response: HTTP Status Code

Jump to

Keyboard shortcuts

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