feat(sniffer): add quic sniffer

This commit is contained in:
5aaee9
2023-10-19 18:30:20 +08:00
parent 0129a8579f
commit de90c276af
10 changed files with 412 additions and 31 deletions

View File

@ -4,7 +4,7 @@ import "github.com/Dreamacro/clash/constant"
type Sniffer interface {
SupportNetwork() constant.NetWork
SniffTCP(bytes []byte) (string, error)
SniffData(bytes []byte) (string, error)
Protocol() string
SupportPort(port uint16) bool
}
@ -12,10 +12,11 @@ type Sniffer interface {
const (
TLS Type = iota
HTTP
QUIC
)
var (
List = []Type{TLS, HTTP}
List = []Type{TLS, HTTP, QUIC}
)
type Type int
@ -26,6 +27,8 @@ func (rt Type) String() string {
return "TLS"
case HTTP:
return "HTTP"
case QUIC:
return "QUIC"
default:
return "Unknown"
}