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 (
"context"
"errors"
"io"
"net"
"time"
@ -17,11 +18,16 @@ func (r *Reject) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn,
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 {
return &Reject{
Base: &Base{
name: "REJECT",
tp: C.Reject,
udp: true,
},
}
}