account.go 311 B

1234567891011121314151617181920
  1. package protocol
  2. import (
  3. "github.com/v2ray/v2ray-core/common/dice"
  4. )
  5. type Account interface {
  6. }
  7. type VMessAccount struct {
  8. ID *ID
  9. AlterIDs []*ID
  10. }
  11. func (this *VMessAccount) AnyValidID() *ID {
  12. if len(this.AlterIDs) == 0 {
  13. return this.ID
  14. }
  15. return this.AlterIDs[dice.Roll(len(this.AlterIDs))]
  16. }