This is the first stable release of the redesigned SSH tunnel package.
Key Features
- Simplified API with context support for easier usage
- Graceful shutdown with context cancellation
- Configurable connection limits and timeouts for resource management
- Improved performance with buffered data transfer using io.CopyBuffer
- Secure host key verification support with known_hosts integration
- Removed legacy implementations including SSH client and SOCKS5 proxy
Breaking Changes
This release replaces the old API with a much simpler and more efficient implementation. The legacy SSH client and SOCKS5 implementations have been removed.
Usage
The new API is much simpler:
config := &sshts.TunnelConfig{
User: "username",
AuthMethods: []ssh.AuthMethod{
ssh.PublicKeys(signer),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(), // Or use knownhosts for security
}
tunnel := sshts.NewTunnel("localhost:8080", "localhost:80", config)
ctx, cancel := context.WithCancel(context.Background())
tunnelCancel, err := tunnel.Start(ctx, "ssh-server.example.com:22")
// ... use tunnel ...
tunnelCancel()
tunnel.Close()