mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-05 19:44:32 -04:00
* remove v2ctl, wv2ray * remove v2ctl, wv2ray build scripts * remove infra/control/main * remove !confonly flag * remove ctlcmd package * remove Confgi.Override func * move commands package into main
39 lines
994 B
Go
39 lines
994 B
Go
package vless
|
|
|
|
import (
|
|
"v2ray.com/core/common/protocol"
|
|
"v2ray.com/core/common/uuid"
|
|
)
|
|
|
|
// AsAccount implements protocol.Account.AsAccount().
|
|
func (a *Account) AsAccount() (protocol.Account, error) {
|
|
id, err := uuid.ParseString(a.Id)
|
|
if err != nil {
|
|
return nil, newError("failed to parse ID").Base(err).AtError()
|
|
}
|
|
return &MemoryAccount{
|
|
ID: protocol.NewID(id),
|
|
Flow: a.Flow, // needs parser here?
|
|
Encryption: a.Encryption, // needs parser here?
|
|
}, nil
|
|
}
|
|
|
|
// MemoryAccount is an in-memory form of VLess account.
|
|
type MemoryAccount struct {
|
|
// ID of the account.
|
|
ID *protocol.ID
|
|
// Flow of the account.
|
|
Flow string
|
|
// Encryption of the account. Used for client connections, and only accepts "none" for now.
|
|
Encryption string
|
|
}
|
|
|
|
// Equals implements protocol.Account.Equals().
|
|
func (a *MemoryAccount) Equals(account protocol.Account) bool {
|
|
vlessAccount, ok := account.(*MemoryAccount)
|
|
if !ok {
|
|
return false
|
|
}
|
|
return a.ID.Equals(vlessAccount.ID)
|
|
}
|