Releases: ngrok/ngrok-go
Releases · ngrok/ngrok-go
v2.1.1
What's Changed
Fixes
- Don't close connections twice after join completes by @andrewryno in #217
- Pass agentSession directly to event emitters instead of locked field by @andrewryno in #218
New Contributors
- @Alice-Lilith made their first contribution in #214
- @bmpngrok made their first contribution in #216
- @andrewryno made their first contribution in #217
Full Changelog: v2.1.0...v2.1.1
v2.1.0
What's Changed
- change: replace log15 with slog.Logger everywhere by @euank in #205
- feat: feat: Increase logging around proxy conn by @jonstacks in #212
Full Changelog: v2.0.0...v2.1.0
v2.0.0
This is a breaking-change release that updates ngrok-go to a new, simplified API.
Enhancements
- Dramatically simplified the API to remove many overlapping options, options that are now deprecated, unnecessary convenience functions, and more.
- Simplified the API by removing all protocol-specific behaviors (which have all been moved to Traffic Policy).
- Removed the config package. All of its options are now folded into the top-level package or removed because they were migrated into Traffic Policy.
- Updates the API to use new ngrok terminology of Agents, Endpoints Upstreams, and Traffic Policy.
- Removes functionality that is now deprecated (like labeled tunnels).
- Added support for agent-based TLS termination and Mutual TLS termination.
- Added support for full TLS control over forwarding to the upstream.
- Added support for full control over dialing the upstream.
- Removed a bespoke logging interface in favor of log/slog.
- Removed the prototype policy package that was not well supported.
- Separated out a concept of an Agent from its Session which were previously co-mingled.
- Added integration tests.
Example Listen
ln, _ := ngrok.Listen(ngrok.WithURL("https://example.ngrok.app"))
http.Serve(ln, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello world")
}))
Example Forward:
ngrok.Forward(
ngrok.WithUpstream("localhost:8080"),
ngrok.WithURL("https://inconshreveable.internal"),
ngrok.WithPoolingEnabled(true),
)
New API
package ngrok // import "golang.ngrok.com/ngrok/v2"
var DefaultAgent = NewAgent(WithAuthtoken(os.Getenv("NGROK_AUTHTOKEN")))
func Forward(ctx context.Context, upstream *Upstream, opts ...EndpointOption) (EndpointForwarder, error)
func Listen(ctx context.Context, opts ...EndpointOption) (EndpointListener, error)
func NewAgent(agentOpts ...AgentOption) (Agent, error)
type Agent interface{ ... }
type AgentOption func(*agentOpts)
func WithAgentConnectCAs(pool *x509.CertPool) AgentOption
func WithAgentConnectURL(addr string) AgentOption
func WithAgentDescription(desc string) AgentOption
func WithAgentMetadata(meta string) AgentOption
func WithAuthtoken(token string) AgentOption
func WithAutoConnect(auto bool) AgentOption
func WithClientInfo(clientType, version string, comments ...string) AgentOption
func WithDialer(dialer Dialer) AgentOption
func WithEventHandler(handler EventHandler) AgentOption
func WithHeartbeatInterval(interval time.Duration) AgentOption
func WithHeartbeatTolerance(tolerance time.Duration) AgentOption
func WithLogger(logger *slog.Logger) AgentOption
func WithMultiLeg(enable bool) AgentOption
func WithProxyURL(urlSpec string) AgentOption
func WithRPCHandler(handler RPCHandler) AgentOption
func WithTLSConfig(tlsCustomizer func(*tls.Config)) AgentOption
type AgentSession interface{ ... }
type Dialer interface{ ... }
type Endpoint interface{ ... }
type EndpointForwarder interface{ ... }
type EndpointListener interface{ ... }
type EndpointOption func(*endpointOpts)
func WithAgentTLSTermination(config *tls.Config) EndpointOption
func WithBindings(bindings ...string) EndpointOption
func WithDescription(desc string) EndpointOption
func WithMetadata(meta string) EndpointOption
func WithPoolingEnabled(pool bool) EndpointOption
func WithTrafficPolicy(policy string) EndpointOption
func WithURL(urlSpec string) EndpointOption
type Error interface{ ... }
type Event interface{ ... }
type EventAgentConnectSucceeded struct{ ... }
type EventAgentDisconnected struct{ ... }
type EventAgentHeartbeatReceived struct{ ... }
type EventHandler func(Event)
type EventType int
const EventTypeAgentConnectSucceeded EventType = iota ...
type ProxyProtoVersion string
const ProxyProtoV1 ProxyProtoVersion = "v1" ...
type RPCHandler func(context.Context, AgentSession, rpc.Request) ([]byte, error)
type Upstream struct{ ... }
func WithUpstream(addr string, opts ...UpstreamOption) *Upstream
type UpstreamOption func(*Upstream)
func WithUpstreamDialer(dialer Dialer) UpstreamOption
func WithUpstreamProtocol(proto string) UpstreamOption
func WithUpstreamProxyProto(proxyProto ProxyProtoVersion) UpstreamOption
func WithUpstreamTLSClientConfig(config *tls.Config) UpstreamOption
v1.12.1
What's Changed
- fix: Reported version of the ngrok-go SDK by @jonstacks in #201
Full Changelog: v1.12.0...v1.12.1
v1.12.0
Version 1.11.0
Enhancements:
- Adds WithAllowsPooling option, allowing the endpoint to pool with other endpoints with the same host/port/binding
- Adds WithURL option, specifying a URL for the endpoint
- Adds WithTrafficPolicy option, applying Traffic Policy to the endpoint
Changes:
- Deprecates WithPolicyString in favor of WithTrafficPolicy
Version 1.10.0
Enhancements
- add fasthttp example
- add
WithBindingssupport - add support for
TrafficPolicyfield
Changes
- replace log adapter module license symlinks with full files
- send
Policyto the backend as aTrafficPolicystring - unsafe.Pointer -> atomic.Pointer
Bug fixes
- Propagate half-closes correctly in forward
Version 1.9.1
Bug fixes:
- Protect against writing to closed channel on shutdown
Version 1.9.0
Enhancements:
- Adds
WithAdditionalServersandWithMultiLegoptions
Version 1.8.1
Enhancements:
- Provides access to structs for building a Traffic Policy configuration
Changes:
- Renames pre-release option WithPolicyConfig to WithPolicyString
- Changes signature of WithPolicy option to accept the newly exposed structs for building a Traffic Policy configuration