Skip to content

Commit

Permalink
Define minimal interface for tunnel logger (#9)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nyergler committed Sep 30, 2020
1 parent 8447f1e commit 76be6fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ssh_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ package sshtunnel

import (
"io"
"log"
"net"

"golang.org/x/crypto/ssh"
)

type logger interface {
Printf(string, ...interface{})
}

type SSHTunnel struct {
Local *Endpoint
Server *Endpoint
Remote *Endpoint
Config *ssh.ClientConfig
Log *log.Logger
Log logger
Conns []net.Conn
SvrConns []*ssh.Client
isOpen bool
Expand Down

0 comments on commit 76be6fd

Please sign in to comment.