Closed iambudi closed 3 years ago
Well found it after digging the code. Please correct me if this is the proper way to set custom dialer?
// Implementation of Dialer interface
type SSHTunnelDialer struct {
SSHClient *ssh.Client
}
func (d SSHTunnelDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error) {
log.Println("Dialing mssql server via tunnel...")
return d.SSHClient.Dial(network, addr)
}
connector, _ := mssql.NewConnector("sqlserver://my-dsn-connection")
connector.Dialer = SSHTunnelDialer{}
db := sql.OpenDB(connector)
Hi All,
In Go MySQL driver we can use
mysql.RegisterDialContext()
to connect to MySQL database host via*ssh.Client
tunneling.Any guidance on where to use it in Go MSSQL?
Thanks.