Fix: reject should support udp and return dial error

This commit is contained in:
Dreamacro 2019-12-30 10:51:35 +08:00
parent 6ce7b6ef83
commit 9dda932494

View file

@ -2,6 +2,7 @@ package outbound
import ( import (
"context" "context"
"errors"
"io" "io"
"net" "net"
"time" "time"
@ -17,11 +18,16 @@ func (r *Reject) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn,
return newConn(&NopConn{}, r), nil return newConn(&NopConn{}, r), nil
} }
func (r *Reject) DialUDP(metadata *C.Metadata) (C.PacketConn, net.Addr, error) {
return nil, nil, errors.New("match reject rule")
}
func NewReject() *Reject { func NewReject() *Reject {
return &Reject{ return &Reject{
Base: &Base{ Base: &Base{
name: "REJECT", name: "REJECT",
tp: C.Reject, tp: C.Reject,
udp: true,
}, },
} }
} }