clash/constant/sniffer/sniffer.go

33 lines
434 B
Go
Raw Normal View History

2022-05-02 00:46:24 +00:00
package sniffer
import "github.com/Dreamacro/clash/constant"
type Sniffer interface {
2022-05-02 00:46:24 +00:00
SupportNetwork() constant.NetWork
SniffTCP(bytes []byte) (string, error)
Protocol() string
2023-01-23 05:16:25 +00:00
SupportPort(port uint16) bool
}
const (
2022-05-02 00:46:24 +00:00
TLS Type = iota
HTTP
)
var (
2022-05-02 00:46:24 +00:00
List = []Type{TLS, HTTP}
)
2022-05-02 00:46:24 +00:00
type Type int
2022-05-02 00:46:24 +00:00
func (rt Type) String() string {
switch rt {
case TLS:
return "TLS"
2022-05-01 21:10:18 +00:00
case HTTP:
return "HTTP"
default:
return "Unknown"
}
}