github.com/kelleygo/clashcore@v1.0.2/constant/sniffer/sniffer.go (about)

     1  package sniffer
     2  
     3  import "github.com/kelleygo/clashcore/constant"
     4  
     5  type Sniffer interface {
     6  	SupportNetwork() constant.NetWork
     7  	// SniffData must not change input bytes
     8  	SniffData(bytes []byte) (string, error)
     9  	Protocol() string
    10  	SupportPort(port uint16) bool
    11  }
    12  
    13  const (
    14  	TLS Type = iota
    15  	HTTP
    16  	QUIC
    17  )
    18  
    19  var (
    20  	List = []Type{TLS, HTTP, QUIC}
    21  )
    22  
    23  type Type int
    24  
    25  func (rt Type) String() string {
    26  	switch rt {
    27  	case TLS:
    28  		return "TLS"
    29  	case HTTP:
    30  		return "HTTP"
    31  	case QUIC:
    32  		return "QUIC"
    33  	default:
    34  		return "Unknown"
    35  	}
    36  }