mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: 数据库、redis、mongo支持ssh隧道等
This commit is contained in:
36
server/pkg/utils/ssh_conn_wrap.go
Normal file
36
server/pkg/utils/ssh_conn_wrap.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type WrapSshConn struct {
|
||||
Conn net.Conn
|
||||
}
|
||||
|
||||
func (c *WrapSshConn) Read(b []byte) (n int, err error) {
|
||||
return c.Conn.Read(b)
|
||||
}
|
||||
|
||||
func (c *WrapSshConn) Write(b []byte) (n int, err error) {
|
||||
return c.Conn.Write(b)
|
||||
}
|
||||
func (c *WrapSshConn) Close() error {
|
||||
return c.Conn.Close()
|
||||
}
|
||||
func (c *WrapSshConn) LocalAddr() net.Addr {
|
||||
return c.Conn.LocalAddr()
|
||||
}
|
||||
func (c *WrapSshConn) RemoteAddr() net.Addr {
|
||||
return c.Conn.RemoteAddr()
|
||||
}
|
||||
func (c *WrapSshConn) SetDeadline(t time.Time) error {
|
||||
return c.Conn.SetDeadline(t)
|
||||
}
|
||||
func (c *WrapSshConn) SetReadDeadline(t time.Time) error {
|
||||
return nil
|
||||
}
|
||||
func (c *WrapSshConn) SetWriteDeadline(t time.Time) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user