1
0

https.go 526 B

123456789101112131415161718192021222324252627282930313233
  1. package handler
  2. import (
  3. "ehang.io/nps/lib/enet"
  4. )
  5. const (
  6. recordTypeHandshake uint8 = 22
  7. typeClientHello uint8 = 1
  8. )
  9. type HttpsHandler struct {
  10. DefaultHandler
  11. }
  12. func NewHttpsHandler() *HttpsHandler {
  13. return &HttpsHandler{}
  14. }
  15. func (h *HttpsHandler) GetName() string {
  16. return "https"
  17. }
  18. func (h *HttpsHandler) GetZhName() string {
  19. return "https协议"
  20. }
  21. func (h *HttpsHandler) HandleConn(b []byte, c enet.Conn) (bool, error) {
  22. if b[0] == recordTypeHandshake{
  23. return h.processConn(c)
  24. }
  25. return false, nil
  26. }