-
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor(proxy): make proxies registerable
- Loading branch information
Showing
18 changed files
with
423 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package engine | ||
|
||
import ( | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/direct" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/http" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/reject" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/relay" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/shadowsocks" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/socks4" | ||
_ "github.com/xjasonlyu/tun2socks/v2/proxy/socks5" | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
"net" | ||
|
||
M "github.com/xjasonlyu/tun2socks/v2/metadata" | ||
"github.com/xjasonlyu/tun2socks/v2/proxy" | ||
) | ||
|
||
var _ proxy.Proxy = (*Base)(nil) | ||
|
||
type Base struct { | ||
protocol, address string | ||
} | ||
|
||
func New(protocol, address string) *Base { | ||
return &Base{ | ||
protocol: protocol, | ||
address: address, | ||
} | ||
} | ||
|
||
func (b *Base) Address() string { | ||
return b.address | ||
} | ||
|
||
func (b *Base) Protocol() string { | ||
return b.protocol | ||
} | ||
|
||
func (b *Base) String() string { | ||
return fmt.Sprintf("%s://%s", b.protocol, b.address) | ||
} | ||
|
||
func (b *Base) DialContext(context.Context, *M.Metadata) (net.Conn, error) { | ||
return nil, errors.ErrUnsupported | ||
} | ||
|
||
func (b *Base) DialUDP(*M.Metadata) (net.PacketConn, error) { | ||
return nil, errors.ErrUnsupported | ||
} |
Oops, something went wrong.