mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 09:16:58 +08:00
Feature: add reject proxy
This commit is contained in:
32
proxy/reject.go
Normal file
32
proxy/reject.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
|
||||
M "github.com/xjasonlyu/tun2socks/constant"
|
||||
"github.com/xjasonlyu/tun2socks/proxy/proto"
|
||||
)
|
||||
|
||||
var _ Proxy = (*Reject)(nil)
|
||||
|
||||
type Reject struct {
|
||||
*Base
|
||||
}
|
||||
|
||||
func NewReject() *Reject {
|
||||
return &Reject{
|
||||
Base: &Base{
|
||||
proto: proto.Reject,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reject) DialContext(context.Context, *M.Metadata) (net.Conn, error) {
|
||||
return nil, errors.New("TCP rejected")
|
||||
}
|
||||
|
||||
func (r *Reject) DialUDP(*M.Metadata) (net.PacketConn, error) {
|
||||
return nil, errors.New("UDP rejected")
|
||||
}
|
Reference in New Issue
Block a user