1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-05 00:47:51 -05:00
v2fly/transport/internet/websocket/config.go
database64128 c78ee5aac7
🏡 Housekeeping: Update to Go 1.17 (#1215)
* ⬆ Update to Go 1.17

* 🏗 Update workflows and add windows-arm64

* 💾 Update generated files

* 📛 Update not-so-friendly filenames
2021-08-21 13:20:40 +08:00

39 lines
653 B
Go

//go:build !confonly
// +build !confonly
package websocket
import (
"net/http"
"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/transport/internet"
)
const protocolName = "websocket"
func (c *Config) GetNormalizedPath() string {
path := c.Path
if path == "" {
return "/"
}
if path[0] != '/' {
return "/" + path
}
return path
}
func (c *Config) GetRequestHeader() http.Header {
header := http.Header{}
for _, h := range c.Header {
header.Add(h.Key, h.Value)
}
return header
}
func init() {
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
return new(Config)
}))
}