Documentation ¶
Index ¶
- Constants
- Variables
- type Broker
- func (b *Broker) Add(name, rHost string, rPort, lPort uint16) (*Tunnel, error)
- func (b *Broker) Cleanup()
- func (b *Broker) Close()
- func (b *Broker) Delete(id uint32) error
- func (b *Broker) Get(id uint32) (*Tunnel, error)
- func (b *Broker) Tunnels() []*Tunnel
- func (b *Broker) Update(id uint32, rHost string, rPort uint16) (*Tunnel, error)
- type Client
- func (c *Client) Create(name string, serverPort, clientPort uint16) (*TunnelResponse, error)
- func (c *Client) Delete() (*TunnelResponse, error)
- func (c *Client) List() (list []TunnelResponse, err error)
- func (c *Client) Update(id uint32, name string, serverPort, clientPort uint16) (*TunnelResponse, error)
- type Server
- type ServerConfig
- type Tunnel
- type TunnelRequest
- type TunnelResponse
Constants ¶
View Source
const HTTPAuthHeader = "X-IP6TUN-AUTH"
Variables ¶
View Source
var (
ErrTunnelNotFound = errors.New("Tunnel not found")
)
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker
func (*Broker) Cleanup ¶
func (b *Broker) Cleanup()
Cleanup deletes clients which haven't been updated for some time
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a simple REST-Client to access a ip6tun server
func NewClient ¶
NewClient instantiates a new client which is able to communicate with the server at host:port
func (*Client) Create ¶
func (c *Client) Create(name string, serverPort, clientPort uint16) (*TunnelResponse, error)
Create a new tunnel on the server
func (*Client) Delete ¶
func (c *Client) Delete() (*TunnelResponse, error)
func (*Client) List ¶
func (c *Client) List() (list []TunnelResponse, err error)
List returns a list of all active tunnels
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config *ServerConfig) (*Server, error)
NewServer returns a new initialized ip6tun server
type ServerConfig ¶
type ServerConfig struct { Debug bool `default:"false"` Port int `default:"8080"` ServerName string `default:"localhost"` APIKey string `required:"true"` CertFile string `envconfig:"tls_cert" required:"true"` KeyFile string `envconfig:"tls_key" required:"true"` MaxIdle time.Duration `default:"86400"` }
func (*ServerConfig) String ¶
func (c *ServerConfig) String() string
type Tunnel ¶
type Tunnel struct { Id uint32 `json:"id"` Name string `json:"name"` LocalPort uint16 `json:"local_port"` RemoteHost string `json:"remote_host"` RemotePort uint16 `json:"remote_port"` MessageLog []string `json:"message_log"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` // contains filtered or unexported fields }
Tunnel is a 4in6 tunnel
type TunnelRequest ¶
type TunnelRequest struct { Name string `json:"name"` LocalPort uint16 `json:"local_port"` RemotePort uint16 `json:"remote_port"` }
reqTunnel is used for create & update
func (*TunnelRequest) Validate ¶
func (t *TunnelRequest) Validate() error
Validate checks if given ports are in range and if the name is not empty.
type TunnelResponse ¶
type TunnelResponse struct { Id uint32 `json:"id"` Name string `json:"name"` LocalPort uint16 `json:"local_port"` RemoteHost string `json:"remote_host"` RemotePort uint16 `json:"remote_port"` MessageLog []string `json:"message_log"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.