Documentation
¶
Overview ¶
[INPUT]: 设备身份、签名握手、WebSocket 与对应通道的 yamux 配置。 [OUTPUT]: 验证设备证明,发布控制路由,按代次附着数据通道。 [POS]: 设备隧道入口,与 lease 的存活探测共用进程接管窗口。 [PROTOCOL]: 变更时更新此头部,然后检查 guidelines.md
[INPUT]: 设备登记与当前执行路由的存活窗口。 [OUTPUT]: 返回运行状态和分页设备快照。 [POS]: 设备目录的投影,按与代理一致的期限决定设备是否在线。 [PROTOCOL]: 变更时更新此头部,然后检查 guidelines.md
[INPUT]: 签名租约、授权存储、控制事件流与 yamux Ping。 [OUTPUT]: 核验访问租约,定期探测并按最近有效 Pong 判定失联,传递撤销。 [POS]: 设备控制路由的存活与授权检查,网络读写在服务锁外执行。 [PROTOCOL]: 变更时更新此头部,然后检查 guidelines.md
[INPUT]: 设备登记、身份授权、yamux 会话与结构化日志。 [OUTPUT]: 组装 relay 服务,按代次回收设备访问并记录首次关闭原因。 [POS]: relay 服务入口,按控制或数据通道分配复用器的超时预算。 [PROTOCOL]: 变更时更新此头部,然后检查 guidelines.md
Index ¶
- Constants
- func FileGrantBytes(grant FileGrant) ([]byte, error)
- func FileGrantV1Bytes(grant FileGrantV1) ([]byte, error)
- func PreviewGuard(template string) func(http.Handler) http.Handler
- func PreviewOrigin(template, server, user, machine, session, artifact string) string
- func ProofBytes(hello Hello, challenge Challenge) ([]byte, error)
- type Challenge
- type Config
- type ConnectionRequest
- type ConnectionResponse
- type FileAuthorization
- type FileGrant
- type FileGrantV1
- type Hello
- type LeaseRequest
- type Proof
- type Ready
- type ReadyAck
- type Service
- func (s *Service) DeviceAuthorizationKey() []byte
- func (s *Service) Directory() http.Handler
- func (s *Service) DisconnectRuntime(user, machine string)
- func (s *Service) InvalidateDevice(user, machine string, version int64)
- func (s *Service) InvalidateGrant(id string)
- func (s *Service) Metadata() map[string]any
- func (s *Service) Metrics() map[string]int64
- func (s *Service) Register(router chi.Router)
- func (s *Service) Run(ctx context.Context)
- func (s *Service) RuntimeReady(ctx context.Context, user, machine string) (bool, error)
- func (s *Service) RuntimeStatus(_ context.Context, user, machine string) (string, string, int64, error)
- func (s *Service) Shutdown(ctx context.Context) error
Constants ¶
const Version = 1
Variables ¶
This section is empty.
Functions ¶
func FileGrantBytes ¶
func FileGrantV1Bytes ¶
func FileGrantV1Bytes(grant FileGrantV1) ([]byte, error)
func PreviewOrigin ¶
Types ¶
type Challenge ¶
type Challenge struct {
Type string `json:"type"`
ServerID string `json:"server_id"`
OwnerUserID string `json:"owner_user_id"`
ChallengeID string `json:"challenge_id"`
Nonce string `json:"nonce"`
TTLMS int64 `json:"ttl_ms"`
ServerTime time.Time `json:"server_time"`
GrantID string `json:"grant_id"`
RegistrationVersion int64 `json:"registration_version"`
}
type ConnectionRequest ¶
type ConnectionResponse ¶
type ConnectionResponse struct {
ConnectionID string `json:"connection_id"`
MachineID string `json:"machine_id"`
HTTPBase string `json:"http_base"`
Ticket string `json:"ticket"`
TicketVersion int64 `json:"ticket_version"`
ExpiresAt time.Time `json:"expires_at"`
ExpiresIn int64 `json:"expires_in"`
ServerTime time.Time `json:"server_time"`
Scopes []string `json:"scopes"`
Protocol json.RawMessage `json:"protocol"`
}
type FileAuthorization ¶
type FileAuthorization struct {
ServerID string `json:"server_id"`
OwnerUserID string `json:"owner_user_id"`
MachineID string `json:"machine_id"`
ConnectionID string `json:"connection_id"`
ClientGrantID string `json:"client_grant_id"`
GrantVersion int64 `json:"grant_version"`
AccessVersion int64 `json:"access_version"`
LeaseEpoch int64 `json:"lease_epoch"`
Scopes []string `json:"scopes"`
}
type FileGrant ¶
type FileGrant struct {
ArtifactID string `json:"artifact_id,omitempty"`
PreviewOrigin string `json:"preview_origin,omitempty"`
Version int `json:"version"`
ServerID string `json:"server_id"`
OwnerUserID string `json:"owner_user_id"`
MachineID string `json:"machine_id"`
SessionID string `json:"session_id"`
Path string `json:"path"`
Scope string `json:"scope"`
KeyID string `json:"key_id"`
GrantVersion int64 `json:"grant_version"`
IssuedAt time.Time `json:"issued_at"`
ExpiresAt time.Time `json:"expires_at"`
ConnectionID string `json:"-"`
ClientGrantID string `json:"-"`
AccessVersion int64 `json:"-"`
LeaseEpoch int64 `json:"-"`
Scopes []string `json:"-"`
}
type FileGrantV1 ¶
type FileGrantV1 struct {
Type string `json:"type"`
Version int `json:"version"`
KeyID string `json:"key_id"`
Authorization FileAuthorization `json:"authorization"`
SessionID string `json:"session_id"`
Path string `json:"path"`
Purpose string `json:"purpose"`
IssuedAt int64 `json:"issued_at"`
ExpiresAt int64 `json:"expires_at"`
}
type Hello ¶
type Hello struct {
Type string `json:"type"`
TunnelVersion int `json:"tunnel_version"`
ChannelKind string `json:"channel_kind"`
MachineID string `json:"machine_id"`
ExecutionPublicKey string `json:"execution_public_key"`
BootID string `json:"boot_id"`
DisplayName string `json:"display_name"`
Platform string `json:"platform"`
Arch string `json:"arch"`
DeploymentMode string `json:"deployment_mode"`
Intent string `json:"intent"`
RestoreRevoked bool `json:"restore_revoked"`
LeaseEpoch int64 `json:"lease_epoch"`
RuntimeVersion string `json:"runtime_version,omitempty"`
EngineVersion string `json:"engine_version,omitempty"`
Protocols map[string][]int `json:"protocols"`
}
type LeaseRequest ¶
type Ready ¶
type Ready struct {
Type string `json:"type"`
ServerID string `json:"server_id"`
MachineID string `json:"machine_id"`
RegistrationVersion int64 `json:"registration_version"`
GrantVersion int64 `json:"grant_version"`
LeaseEpoch int64 `json:"lease_epoch,omitempty"`
Bound bool `json:"bound,omitempty"`
PublicAddresses map[string]string `json:"public_addresses,omitempty"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}