mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-05 16:56:54 +08:00
38 lines
657 B
Go
Executable File
38 lines
657 B
Go
Executable File
package proxy
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net"
|
|
|
|
M "github.com/xjasonlyu/tun2socks/constant"
|
|
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
|
)
|
|
|
|
var _ Proxy = (*Base)(nil)
|
|
|
|
type Base struct {
|
|
addr string
|
|
proto proto.Proto
|
|
}
|
|
|
|
func NewBase(addr string, proto proto.Proto) *Base {
|
|
return &Base{addr: addr, proto: proto}
|
|
}
|
|
|
|
func (b *Base) Addr() string {
|
|
return b.addr
|
|
}
|
|
|
|
func (b *Base) Proto() proto.Proto {
|
|
return b.proto
|
|
}
|
|
|
|
func (b *Base) DialContext(context.Context, *M.Metadata) (net.Conn, error) {
|
|
return nil, errors.New("not supported")
|
|
}
|
|
|
|
func (b *Base) DialUDP(*M.Metadata) (net.PacketConn, error) {
|
|
return nil, errors.New("not supported")
|
|
}
|