mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 17:38:41 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
40
proxy/vless/account.go
Normal file
40
proxy/vless/account.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
// +build !confonly
|
||||
|
||||
package vless
|
||||
|
||||
import (
|
||||
"github.com/xtls/xray-core/v1/common/protocol"
|
||||
"github.com/xtls/xray-core/v1/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. May be "xtls-rprx-direct".
|
||||
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue