Documentation
¶
Index ¶
- func CreateConfig(data map[string]string, name string, t string) error
- func DeleteConfigByName(name string) error
- func GetConfigByName(name string) (map[string]string, error)
- func GetJSON(url string, v interface{}) error
- func Mount(mountPoint, fs string) error
- func OasisGet(url string) string
- func PostJSON(url string, body interface{}, v interface{}) error
- func ReadZeroTierAuthToken() (string, error)
- func Unmount(mountPoint string) error
- type Client
- func (c *Client) Delete(path string) (*Response, error)
- func (c *Client) DeleteContext(ctx context.Context, path string) (*Response, error)
- func (c *Client) Download(url, savePath string, onProgress func(current, total int64)) error
- func (c *Client) DownloadContext(ctx context.Context, downloadURL, savePath string, ...) error
- func (c *Client) Get(path string) (*Response, error)
- func (c *Client) GetContext(ctx context.Context, path string) (*Response, error)
- func (c *Client) Patch(path string, body interface{}) (*Response, error)
- func (c *Client) PatchContext(ctx context.Context, path string, body interface{}) (*Response, error)
- func (c *Client) Post(path string, body interface{}) (*Response, error)
- func (c *Client) PostContext(ctx context.Context, path string, body interface{}) (*Response, error)
- func (c *Client) PostForm(path string, data url.Values) (*Response, error)
- func (c *Client) PostFormContext(ctx context.Context, path string, data url.Values) (*Response, error)
- func (c *Client) Put(path string, body interface{}) (*Response, error)
- func (c *Client) PutContext(ctx context.Context, path string, body interface{}) (*Response, error)
- func (c *Client) WithBaseURL(baseURL string) *Client
- func (c *Client) WithBearerToken(token string) *Client
- func (c *Client) WithHeader(key, value string) *Client
- func (c *Client) WithHeaders(headers map[string]string) *Client
- func (c *Client) WithRetry(count int, delay time.Duration) *Client
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- type DriveClient
- func (d *DriveClient) Copy(srcPath, dstPath string) error
- func (d *DriveClient) CreateDir(path string) error
- func (d *DriveClient) Delete(path string) error
- func (d *DriveClient) Download(remotePath, localPath string) error
- func (d *DriveClient) GetInfo(path string) (*DriveFile, error)
- func (d *DriveClient) GetQuota() (*DriveQuota, error)
- func (d *DriveClient) GetShareLink(path string, expiry time.Duration) (string, error)
- func (d *DriveClient) List(path string) ([]DriveFile, error)
- func (d *DriveClient) Move(srcPath, dstPath string) error
- func (d *DriveClient) Rename(path, newName string) error
- func (d *DriveClient) Search(query string) ([]DriveFile, error)
- func (d *DriveClient) SetAuthToken(token string) *DriveClient
- func (d *DriveClient) Upload(localPath, remotePath string) error
- type DriveFile
- type DriveQuota
- type MountList
- type MountPoint
- type RemotesResult
- type Response
- type ZeroTierClient
- func (z *ZeroTierClient) GetAddress() (string, error)
- func (z *ZeroTierClient) GetNetwork(networkID string) (*ZeroTierNetwork, error)
- func (z *ZeroTierClient) GetNetworkIPs(networkID string) ([]string, error)
- func (z *ZeroTierClient) GetPeer(address string) (*ZeroTierPeer, error)
- func (z *ZeroTierClient) GetStatus() (*ZeroTierStatus, error)
- func (z *ZeroTierClient) GetVersion() (string, error)
- func (z *ZeroTierClient) IsOnline() bool
- func (z *ZeroTierClient) JoinNetwork(networkID string) (*ZeroTierNetwork, error)
- func (z *ZeroTierClient) LeaveNetwork(networkID string) error
- func (z *ZeroTierClient) ListNetworks() ([]ZeroTierNetwork, error)
- func (z *ZeroTierClient) ListPeers() ([]ZeroTierPeer, error)
- func (z *ZeroTierClient) WaitForNetwork(networkID string, timeout time.Duration) error
- type ZeroTierNetwork
- type ZeroTierPath
- type ZeroTierPeer
- type ZeroTierStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateConfig ¶
CreateConfig 创建配置(占位符实现)
func DeleteConfigByName ¶
DeleteConfigByName 删除配置(CasaOS 兼容)
func GetConfigByName ¶
GetConfigByName 根据名称获取配置(CasaOS 兼容)
func ReadZeroTierAuthToken ¶
ReadZeroTierAuthToken 从文件读取认证令牌
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client HTTP 客户端
func (*Client) DeleteContext ¶
DeleteContext 发送带上下文的 DELETE 请求
func (*Client) DownloadContext ¶
func (c *Client) DownloadContext(ctx context.Context, downloadURL, savePath string, onProgress func(current, total int64)) error
DownloadContext 带上下文下载文件
func (*Client) GetContext ¶
GetContext 发送带上下文的 GET 请求
func (*Client) PatchContext ¶
func (c *Client) PatchContext(ctx context.Context, path string, body interface{}) (*Response, error)
PatchContext 发送带上下文的 PATCH 请求
func (*Client) PostContext ¶
PostContext 发送带上下文的 POST 请求
func (*Client) PostFormContext ¶
func (c *Client) PostFormContext(ctx context.Context, path string, data url.Values) (*Response, error)
PostFormContext 发送带上下文的表单 POST 请求
func (*Client) PutContext ¶
PutContext 发送带上下文的 PUT 请求
func (*Client) WithBaseURL ¶
WithBaseURL 设置基础 URL
func (*Client) WithBearerToken ¶
WithBearerToken 设置 Bearer Token
func (*Client) WithHeaders ¶
WithHeaders 设置多个请求头
type DriveClient ¶
type DriveClient struct {
// contains filtered or unexported fields
}
DriveClient 网盘/云存储客户端
func NewDriveClient ¶
func NewDriveClient(baseURL, authToken string) *DriveClient
NewDriveClient 创建网盘客户端
func (*DriveClient) Download ¶
func (d *DriveClient) Download(remotePath, localPath string) error
Download 下载文件
func (*DriveClient) GetInfo ¶
func (d *DriveClient) GetInfo(path string) (*DriveFile, error)
GetInfo 获取文件/目录信息
func (*DriveClient) GetQuota ¶
func (d *DriveClient) GetQuota() (*DriveQuota, error)
GetQuota 获取存储配额
func (*DriveClient) GetShareLink ¶
GetShareLink 获取分享链接
func (*DriveClient) Rename ¶
func (d *DriveClient) Rename(path, newName string) error
Rename 重命名文件/目录
func (*DriveClient) Search ¶
func (d *DriveClient) Search(query string) ([]DriveFile, error)
Search 搜索文件
func (*DriveClient) SetAuthToken ¶
func (d *DriveClient) SetAuthToken(token string) *DriveClient
SetAuthToken 设置认证令牌
func (*DriveClient) Upload ¶
func (d *DriveClient) Upload(localPath, remotePath string) error
Upload 上传文件
type DriveFile ¶
type DriveFile struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
MimeType string `json:"mime_type"`
ModifiedAt time.Time `json:"modified_at"`
CreatedAt time.Time `json:"created_at"`
DownloadURL string `json:"download_url,omitempty"`
ParentID string `json:"parent_id,omitempty"`
}
DriveFile 文件信息
type DriveQuota ¶
type DriveQuota struct {
Total int64 `json:"total"`
Used int64 `json:"used"`
Free int64 `json:"free"`
}
DriveQuota 配额信息
type MountList ¶
type MountList struct {
MountPoints []MountPoint `json:"mountPoints"`
}
MountList 挂载列表
type MountPoint ¶
MountPoint 挂载点信息
type RemotesResult ¶
RemotesResult 远程配置结果
func GetAllConfigName ¶
func GetAllConfigName() (RemotesResult, error)
GetAllConfigName 获取所有配置名称(CasaOS 兼容)
type ZeroTierClient ¶
type ZeroTierClient struct {
// contains filtered or unexported fields
}
ZeroTierClient ZeroTier API 客户端
func NewZeroTierClient ¶
func NewZeroTierClient(authToken string) *ZeroTierClient
NewZeroTierClient 创建 ZeroTier 客户端
func NewZeroTierClientWithURL ¶
func NewZeroTierClientWithURL(baseURL, authToken string) *ZeroTierClient
NewZeroTierClientWithURL 创建指定 URL 的 ZeroTier 客户端
func (*ZeroTierClient) GetAddress ¶
func (z *ZeroTierClient) GetAddress() (string, error)
GetAddress 获取本机 ZeroTier 地址
func (*ZeroTierClient) GetNetwork ¶
func (z *ZeroTierClient) GetNetwork(networkID string) (*ZeroTierNetwork, error)
GetNetwork 获取网络详情
func (*ZeroTierClient) GetNetworkIPs ¶
func (z *ZeroTierClient) GetNetworkIPs(networkID string) ([]string, error)
GetNetworkIPs 获取网络分配的 IP 地址
func (*ZeroTierClient) GetPeer ¶
func (z *ZeroTierClient) GetPeer(address string) (*ZeroTierPeer, error)
GetPeer 获取节点详情
func (*ZeroTierClient) GetStatus ¶
func (z *ZeroTierClient) GetStatus() (*ZeroTierStatus, error)
GetStatus 获取服务状态
func (*ZeroTierClient) GetVersion ¶
func (z *ZeroTierClient) GetVersion() (string, error)
GetVersion 获取版本号
func (*ZeroTierClient) JoinNetwork ¶
func (z *ZeroTierClient) JoinNetwork(networkID string) (*ZeroTierNetwork, error)
JoinNetwork 加入网络
func (*ZeroTierClient) LeaveNetwork ¶
func (z *ZeroTierClient) LeaveNetwork(networkID string) error
LeaveNetwork 离开网络
func (*ZeroTierClient) ListNetworks ¶
func (z *ZeroTierClient) ListNetworks() ([]ZeroTierNetwork, error)
ListNetworks 列出已加入的网络
func (*ZeroTierClient) ListPeers ¶
func (z *ZeroTierClient) ListPeers() ([]ZeroTierPeer, error)
ListPeers 列出节点
func (*ZeroTierClient) WaitForNetwork ¶
func (z *ZeroTierClient) WaitForNetwork(networkID string, timeout time.Duration) error
WaitForNetwork 等待网络就绪
type ZeroTierNetwork ¶
type ZeroTierNetwork struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
MAC string `json:"mac"`
AssignedAddresses []string `json:"assignedAddresses"`
AllowManaged bool `json:"allowManaged"`
AllowGlobal bool `json:"allowGlobal"`
AllowDefault bool `json:"allowDefault"`
AllowDNS bool `json:"allowDNS"`
Bridge bool `json:"bridge"`
BroadcastEnabled bool `json:"broadcastEnabled"`
PortDeviceName string `json:"portDeviceName"`
NetconfRevision int `json:"netconfRevision"`
}
ZeroTierNetwork 网络信息
type ZeroTierPath ¶
type ZeroTierPath struct {
Active bool `json:"active"`
Address string `json:"address"`
LastReceive int64 `json:"lastReceive"`
LastSend int64 `json:"lastSend"`
Preferred bool `json:"preferred"`
TrustedPathID int64 `json:"trustedPathId"`
}
ZeroTierPath 路径信息
type ZeroTierPeer ¶
type ZeroTierPeer struct {
Address string `json:"address"`
Latency int `json:"latency"`
Role string `json:"role"`
Version string `json:"version"`
Paths []ZeroTierPath `json:"paths"`
}
ZeroTierPeer 节点信息
type ZeroTierStatus ¶
type ZeroTierStatus struct {
Address string `json:"address"`
Clock int64 `json:"clock"`
ClusterNode string `json:"clusterNode,omitempty"`
Online bool `json:"online"`
PublicIdentity string `json:"publicIdentity"`
TCPFallbackActive bool `json:"tcpFallbackActive"`
Version string `json:"version"`
VersionBuild int `json:"versionBuild"`
VersionMajor int `json:"versionMajor"`
VersionMinor int `json:"versionMinor"`
VersionRev int `json:"versionRev"`
}
ZeroTierStatus 服务状态