Feature: vmess add websocket support
This commit is contained in:
@ -38,6 +38,8 @@ type VmessOption struct {
|
||||
AlterID int `proxy:"alterId"`
|
||||
Cipher string `proxy:"cipher"`
|
||||
TLS bool `proxy:"tls,omitempty"`
|
||||
Network string `proxy:"network,omitempty"`
|
||||
WSPath string `proxy:"ws-path,omitempty"`
|
||||
}
|
||||
|
||||
func (ss *Vmess) Name() string {
|
||||
@ -54,17 +56,20 @@ func (ss *Vmess) Generator(metadata *C.Metadata) (adapter C.ProxyAdapter, err er
|
||||
return nil, fmt.Errorf("%s connect error", ss.server)
|
||||
}
|
||||
tcpKeepAlive(c)
|
||||
c = ss.client.New(c, parseVmessAddr(metadata))
|
||||
c, err = ss.client.New(c, parseVmessAddr(metadata))
|
||||
return &VmessAdapter{conn: c}, err
|
||||
}
|
||||
|
||||
func NewVmess(option VmessOption) (*Vmess, error) {
|
||||
security := strings.ToLower(option.Cipher)
|
||||
client, err := vmess.NewClient(vmess.Config{
|
||||
UUID: option.UUID,
|
||||
AlterID: uint16(option.AlterID),
|
||||
Security: security,
|
||||
TLS: option.TLS,
|
||||
UUID: option.UUID,
|
||||
AlterID: uint16(option.AlterID),
|
||||
Security: security,
|
||||
TLS: option.TLS,
|
||||
Host: fmt.Sprintf("%s:%d", option.Server, option.Port),
|
||||
NetWork: option.Network,
|
||||
WebSocketPath: option.WSPath,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user