mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
proxy: added vsock support (#295)
This commit is contained in:
1 parent
ed7ee6bcd4
commit
730e9c765e
8 files changed
+407
-8
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package vsock
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/nadoo/glider/proxy"
|
||||
)
|
||||
|
||||
func init() {
|
||||
proxy.RegisterDialer("vsock", NewVSockDialer)
|
||||
}
|
||||
|
||||
// NewVSockDialer returns a vm socket dialer.
|
||||
func NewVSockDialer(s string, d proxy.Dialer) (proxy.Dialer, error) {
|
||||
return NewVSock(s, d, nil)
|
||||
}
|
||||
|
||||
// Dial connects to the address addr on the network net via the proxy.
|
||||
// NOTE: must be the first dialer in a chain
|
||||
func (s *vsock) Dial(network, addr string) (net.Conn, error) {
|
||||
return Dial(s.cid, s.port)
|
||||
}
|
||||
|
||||
// DialUDP connects to the given address via the proxy.
|
||||
func (s *vsock) DialUDP(network, addr string) (net.PacketConn, error) {
|
||||
return nil, proxy.ErrNotSupported
|
||||
}
|
||||
Reference in new issue
Block a user