accounts

package
v0.1.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package accounts 管理节点内部账户(relay 入站 UUID)的本地持久化。

权威源约定(05 号文档 §4):节点本地文件 `internal_accounts.json` 是唯一权威, 主控 DB 以回执为准覆盖。文件权限 600,写入用 临时文件 + rename 原子替换。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUUID

func NewUUID() (string, error)

NewUUID 生成 UUID v4(crypto/rand,不依赖 xray 二进制)。

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store 内部账户存储({tag: uuid})。

func New

func New(path string) *Store

New 创建存储(路径由 agent 配置注入,默认 /etc/xray-agent/internal_accounts.json)。

func (*Store) Load

func (s *Store) Load() (map[string]string, error)

Load 读取全部账户(文件不存在返回空 map;损坏文件返回错误,不静默覆盖)。

func (*Store) Set

func (s *Store) Set(tag, uuid string) error

Set 写入(或覆盖)tag 的 UUID,原子落盘(临时文件 + rename,权限 600)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL