github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/transport/internet/websocket/config.go (about) 1 // +build !confonly 2 3 package websocket 4 5 import ( 6 "net/http" 7 8 "v2ray.com/core/common" 9 "v2ray.com/core/transport/internet" 10 ) 11 12 const protocolName = "websocket" 13 14 func (c *Config) GetNormalizedPath() string { 15 path := c.Path 16 if path == "" { 17 return "/" 18 } 19 if path[0] != '/' { 20 return "/" + path 21 } 22 return path 23 } 24 25 func (c *Config) GetRequestHeader() http.Header { 26 header := http.Header{} 27 for _, h := range c.Header { 28 header.Add(h.Key, h.Value) 29 } 30 return header 31 } 32 33 func init() { 34 common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} { 35 return new(Config) 36 })) 37 }