config.go 545 B

123456789101112131415161718192021222324252627282930
  1. package websocket
  2. import (
  3. "v2ray.com/core/common"
  4. "v2ray.com/core/transport/internet"
  5. )
  6. func (c *Config) IsConnectionReuse() bool {
  7. if c == nil || c.ConnectionReuse == nil {
  8. return true
  9. }
  10. return c.ConnectionReuse.Enable
  11. }
  12. func (c *Config) GetNormailzedPath() string {
  13. path := c.Path
  14. if len(path) == 0 {
  15. return "/"
  16. }
  17. if path[0] != '/' {
  18. return "/" + path
  19. }
  20. return path
  21. }
  22. func init() {
  23. common.Must(internet.RegisterProtocolConfigCreator(internet.TransportProtocol_WebSocket, func() interface{} {
  24. return new(Config)
  25. }))
  26. }