1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-17 18:06:15 -05:00
v2fly/transport/internet/websocket/config.go

31 lines
545 B
Go
Raw Normal View History

2016-12-22 18:30:46 -05:00
package websocket
2016-08-13 09:44:36 -04:00
2016-10-02 17:43:58 -04:00
import (
"v2ray.com/core/common"
2016-10-02 17:43:58 -04:00
"v2ray.com/core/transport/internet"
2016-08-13 09:44:36 -04:00
)
2016-10-02 17:43:58 -04:00
2017-01-01 15:19:12 -05:00
func (c *Config) IsConnectionReuse() bool {
if c == nil || c.ConnectionReuse == nil {
2017-01-04 09:34:11 -05:00
return true
2016-10-17 08:35:13 -04:00
}
2017-01-01 15:19:12 -05:00
return c.ConnectionReuse.Enable
2016-10-17 08:35:13 -04:00
}
2017-02-10 05:47:53 -05:00
func (c *Config) GetNormailzedPath() string {
path := c.Path
if len(path) == 0 {
return "/"
}
if path[0] != '/' {
return "/" + path
}
return path
}
2016-10-02 17:43:58 -04:00
func init() {
common.Must(internet.RegisterProtocolConfigCreator(internet.TransportProtocol_WebSocket, func() interface{} {
2016-10-02 17:43:58 -04:00
return new(Config)
}))
2016-10-02 17:43:58 -04:00
}