Documentation ¶
Overview ¶
Package localtunnel implements a client library for https://localtunnel.me
In addition to providing the LocalTunnel client which will forward requests from subdomain.localtunnel.me to a port on localhost. This package also provides an implementation of net.Listener which exposes connections from localtunnel. This enables users to serve http requests directly, without listening to a port on localhost.
// Setup a listener for localtunnel listener, err := localtunnel.Listen(localtunnel.Options{}) // Create your server... server := http.Server{ Handler: http.HandleFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) ... }) } // Handle request from localtunnel server.Serve(listener)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultBaseURL = "https://localtunnel.me"
DefaultBaseURL is the default value for the Options.BaseURL
var DefaultMaxConnections = 10
DefaultMaxConnections is the default value for Options.MaxConnections
var ErrListenerClosed = errors.New("listener was closed")
ErrListenerClosed indicates that the listener as closed
Functions ¶
This section is empty.
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener implements a net.Listener using localtunnel.me
type LocalTunnel ¶
type LocalTunnel struct {
// contains filtered or unexported fields
}
LocalTunnel forwards remote requests to a port on localhost
func New ¶
func New(port int, host string, options Options) (*LocalTunnel, error)
New returns a LocalTunnel forwarding requests to port on host
host defaults to 'localhost', and options defaults to using localtunnel.me
func (*LocalTunnel) Close ¶
func (lt *LocalTunnel) Close() error
Close the localtunnel aborting all connections
func (*LocalTunnel) URL ¶
func (lt *LocalTunnel) URL() string
URL returns the URL at which the localtunnel is exposed