Skip to content

Commit 76be6fd

Browse files
authored
Define minimal interface for tunnel logger (#9)
Prior to this commit sshtunnel required the use of the standard library's log package, even though it only used Printf. This commit changes the struct to use an interface, which allows the consumer to drop in a shim to the logger of their choice.
1 parent 8447f1e commit 76be6fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ssh_tunnel.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ package sshtunnel
22

33
import (
44
"io"
5-
"log"
65
"net"
76

87
"golang.org/x/crypto/ssh"
98
)
109

10+
type logger interface {
11+
Printf(string, ...interface{})
12+
}
13+
1114
type SSHTunnel struct {
1215
Local *Endpoint
1316
Server *Endpoint
1417
Remote *Endpoint
1518
Config *ssh.ClientConfig
16-
Log *log.Logger
19+
Log logger
1720
Conns []net.Conn
1821
SvrConns []*ssh.Client
1922
isOpen bool

0 commit comments

Comments
 (0)