Documentation ¶
Index ¶
- Variables
- func IsIPv4(address string) bool
- func Listen()
- func MakeSSHKeyPair() (string, string, error)
- func ProxyTcp(conn net.Conn, addr string, port int, useTls bool, ...) error
- type AlertData
- type Api
- func (a *Api) CreateToken(tokenData TokenData, params url.Values) (string, error)
- func (a *Api) CreateTunnel(tokenData TokenData, params url.Values) (*Tunnel, error)
- func (a *Api) CreateUser(tokenData TokenData, params url.Values) error
- func (a *Api) DeleteClient(tokenData TokenData, ownerId, clientId string) error
- func (a *Api) DeleteToken(tokenData TokenData, params url.Values) error
- func (a *Api) DeleteTunnel(tokenData TokenData, params url.Values) error
- func (a *Api) DeleteUser(tokenData TokenData, params url.Values) error
- func (a *Api) GetTokens(tokenData TokenData, params url.Values) map[string]TokenData
- func (a *Api) GetTunnel(tokenData TokenData, params url.Values) (Tunnel, error)
- func (a *Api) GetTunnels(tokenData TokenData) map[string]Tunnel
- func (a *Api) GetUsers(tokenData TokenData, params url.Values) map[string]User
- func (a *Api) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (a *Api) SetClient(tokenData TokenData, params url.Values, ownerId, clientId string) error
- type Auth
- type Client
- type ClientConfig
- type Config
- type ConfirmData
- type DNSRecord
- type Database
- func (d *Database) AddToken(owner, client string) (string, error)
- func (d *Database) AddUser(username string, isAdmin bool) error
- func (d *Database) DeleteDNSRequest(requestId string)
- func (d *Database) DeleteTokenData(token string)
- func (d *Database) DeleteTunnel(domain string)
- func (d *Database) DeleteUser(username string)
- func (d *Database) GetAdminDomain() string
- func (d *Database) GetDNSRequest(requestId string) (namedrop.DNSRequest, error)
- func (d *Database) GetTokenData(token string) (TokenData, bool)
- func (d *Database) GetTokens() map[string]TokenData
- func (d *Database) GetTunnel(domain string) (Tunnel, bool)
- func (d *Database) GetTunnels() map[string]Tunnel
- func (d *Database) GetUser(username string) (User, bool)
- func (d *Database) GetUsers() map[string]User
- func (d *Database) SetAdminDomain(adminDomain string)
- func (d *Database) SetDNSRequest(requestId string, request namedrop.DNSRequest)
- func (d *Database) SetTokenData(token string, tokenData TokenData)
- func (d *Database) SetTunnel(domain string, tun Tunnel)
- func (d *Database) SetUser(username string, user User) error
- type DbClient
- type LoadingData
- type LoginData
- type LoginRequest
- type PassthroughListener
- type ProxyConn
- func (c ProxyConn) Close() error
- func (c ProxyConn) CloseWrite() error
- func (c ProxyConn) LocalAddr() net.Addr
- func (c ProxyConn) Read(p []byte) (int, error)
- func (c ProxyConn) RemoteAddr() net.Addr
- func (c ProxyConn) SetDeadline(t time.Time) error
- func (c ProxyConn) SetReadDeadline(t time.Time) error
- func (c ProxyConn) SetWriteDeadline(t time.Time) error
- func (c ProxyConn) Write(p []byte) (int, error)
- type ReqResult
- type Server
- type SmtpConfig
- type TokenData
- type Tunnel
- type TunnelManager
- type User
- type WebUiHandler
Constants ¶
This section is empty.
Variables ¶
var DBFolderPath string
Functions ¶
func IsIPv4 ¶ added in v0.9.0
Taken from https://stackoverflow.com/a/48519490/943814
func MakeSSHKeyPair ¶
Adapted from https://stackoverflow.com/a/34347463/943814 MakeSSHKeyPair make a pair of public and private keys for SSH access. Public key is encoded in the format for inclusion in an OpenSSH authorized_keys file. Private Key generated is PEM encoded
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func (*Api) CreateToken ¶
func (*Api) CreateTunnel ¶
func (*Api) DeleteClient ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) Authorized ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
type ClientConfig ¶
type ClientConfig struct { ServerAddr string `json:"serverAddr,omitempty"` Token string `json:"token,omitempty"` ClientName string `json:"clientName,omitempty"` User string `json:"user,omitempty"` CertDir string `json:"certDir,omitempty"` AcmeEmail string `json:"acmeEmail,omitempty"` AcmeUseStaging bool `json:"acmeUseStaging,omitempty"` AcmeCa string `json:"acmeCa,omitempty"` DnsServer string `json:"dnsServer,omitempty"` BehindProxy bool `json:"behindProxy,omitempty"` PollInterval int `json:"pollInterval,omitempty"` }
type ConfirmData ¶
type Database ¶
type Database struct { AdminDomain string `json:"admin_domain"` Tokens map[string]TokenData `json:"tokens"` Tunnels map[string]Tunnel `json:"tunnels"` Users map[string]User `json:"users"` // contains filtered or unexported fields }
func NewDatabase ¶
func (*Database) DeleteDNSRequest ¶ added in v0.8.0
func (*Database) DeleteTokenData ¶
func (*Database) DeleteTunnel ¶
func (*Database) DeleteUser ¶
func (*Database) GetAdminDomain ¶ added in v0.8.0
func (*Database) GetDNSRequest ¶ added in v0.8.0
func (*Database) GetTunnels ¶
func (*Database) SetAdminDomain ¶ added in v0.8.0
func (*Database) SetDNSRequest ¶ added in v0.8.0
func (*Database) SetTokenData ¶
type LoadingData ¶
type LoginRequest ¶
type LoginRequest struct {
Email string
}
type PassthroughListener ¶
type PassthroughListener struct {
// contains filtered or unexported fields
}
func NewPassthroughListener ¶
func NewPassthroughListener() *PassthroughListener
func (*PassthroughListener) Addr ¶
func (f *PassthroughListener) Addr() net.Addr
func (*PassthroughListener) Close ¶
func (f *PassthroughListener) Close() error
func (*PassthroughListener) PassConn ¶
func (f *PassthroughListener) PassConn(conn net.Conn)
type ProxyConn ¶
type ProxyConn struct {
// contains filtered or unexported fields
}
This type creates a new net.Conn that's the same as an old one, except a new reader is provided. So it proxies every method except Read. This is necessary because by calling peekClientHello, part of the reader is read, so we need to create a new reader with the already read data inserted back in the front. I'm sure there's a cleaner way to do this...
func (ProxyConn) Close ¶
TODO: is this safe? Will it actually close properly, or does it need to be connected to the reader somehow?
func (ProxyConn) CloseWrite ¶
func (ProxyConn) RemoteAddr ¶
type Tunnel ¶
type Tunnel struct { Domain string `json:"domain"` ServerAddress string `json:"server_address"` ServerPort int `json:"server_port"` ServerPublicKey string `json:"server_public_key"` Username string `json:"username"` TunnelPort int `json:"tunnel_port"` TunnelPrivateKey string `json:"tunnel_private_key"` ClientAddress string `json:"client_address"` ClientPort int `json:"client_port"` AllowExternalTcp bool `json:"allow_external_tcp"` TlsTermination string `json:"tls_termination"` // TODO: These are not used by clients and possibly shouldn't be // returned in API calls. Owner string `json:"owner"` ClientName string `json:"client_name"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` }
type TunnelManager ¶
type TunnelManager struct {
// contains filtered or unexported fields
}
func NewTunnelManager ¶
func NewTunnelManager(config *Config, db *Database, certConfig *certmagic.Config) *TunnelManager
func (*TunnelManager) DeleteTunnel ¶
func (m *TunnelManager) DeleteTunnel(domain string) error
func (*TunnelManager) GetTunnels ¶
func (m *TunnelManager) GetTunnels() map[string]Tunnel
func (*TunnelManager) RequestCreateTunnel ¶
func (m *TunnelManager) RequestCreateTunnel(tunReq Tunnel) (Tunnel, error)
type WebUiHandler ¶
type WebUiHandler struct {
// contains filtered or unexported fields
}
func NewWebUiHandler ¶
func NewWebUiHandler(config *Config, db *Database, api *Api, auth *Auth) *WebUiHandler