Documentation ¶
Overview ¶
Package localtunnel implements a client library for https://localtunnel.me
localtunnel allows you to expose your localhost to the world for easy testing and sharing!
Exposing a local port:
import "github.com/jweslley/localtunnel" ... var port := 8000 var tunnel := localtunnel.NewLocalTunnel(port) var err := tunnel.Open() if (err != nil) { fmt.Printf("your url is: %s\n", tunnel.URL()) } ... tunnel.Close()
Index ¶
- Variables
- type Client
- type Tunnel
- func (t *Tunnel) Close()
- func (t *Tunnel) Closing() <-chan struct{}
- func (t *Tunnel) LocalHost() string
- func (t *Tunnel) LocalPort() int
- func (t *Tunnel) MaxConn() int
- func (t *Tunnel) Open() error
- func (t *Tunnel) OpenAs(subdomain string) error
- func (t *Tunnel) RemoteHost() string
- func (t *Tunnel) RemotePort() int
- func (t *Tunnel) Subdomain() string
- func (t *Tunnel) URL() string
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = NewClient("https://localtunnel.me")
DefaultClient is the default Client and is used by NewLocalTunnel and NewTunnel.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is an localtunnel client.
func (*Client) NewLocalTunnel ¶
NewLocalTunnel create a tunnel for a server in a given port from localhost.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel forwards remote requests to another server, typically to a port on localhost.
func NewLocalTunnel ¶
NewLocalTunnel create a tunnel for a server in a given port from localhost using the DefaultClient.
func NewTunnel ¶
NewTunnel create a tunnel for a server in a given host and port using the DefaultClient.
func (*Tunnel) Closing ¶
func (t *Tunnel) Closing() <-chan struct{}
Closing is a channel which is closed when the tunnel is closed.
func (*Tunnel) Open ¶
Open setup the tunnel creating connections between the remote and local servers.
func (*Tunnel) OpenAs ¶
Open setup the tunnel creating connections between the remote and local servers with a custom subdomain.