mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 03:00:42 +00:00
feat: freeze ssh and vnc port contracts
Define the minimum machine networking surface for the next host slice and limit exposed guest ports to SSH and VNC.
This commit is contained in:
parent
04575d111c
commit
4028bb5a1d
3 changed files with 33 additions and 10 deletions
|
|
@ -3,15 +3,16 @@ package host
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type Machine struct {
|
type Machine struct {
|
||||||
ID MachineID `json:"id"`
|
ID MachineID `json:"id"`
|
||||||
Artifact ArtifactRef `json:"artifact"`
|
Artifact ArtifactRef `json:"artifact"`
|
||||||
SystemVolumeID VolumeID `json:"system_volume_id,omitempty"`
|
SystemVolumeID VolumeID `json:"system_volume_id,omitempty"`
|
||||||
UserVolumeIDs []VolumeID `json:"user_volume_ids,omitempty"`
|
UserVolumeIDs []VolumeID `json:"user_volume_ids,omitempty"`
|
||||||
Phase MachinePhase `json:"phase"`
|
RuntimeHost string `json:"runtime_host,omitempty"`
|
||||||
RuntimeHost string `json:"runtime_host,omitempty"`
|
Ports []MachinePort `json:"ports,omitempty"`
|
||||||
Error string `json:"error,omitempty"`
|
Phase MachinePhase `json:"phase"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
Error string `json:"error,omitempty"`
|
||||||
StartedAt *time.Time `json:"started_at,omitempty"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
StartedAt *time.Time `json:"started_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateMachineRequest struct {
|
type CreateMachineRequest struct {
|
||||||
|
|
|
||||||
20
contract/networking.go
Normal file
20
contract/networking.go
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package host
|
||||||
|
|
||||||
|
type MachinePortName string
|
||||||
|
|
||||||
|
type PortProtocol string
|
||||||
|
|
||||||
|
const (
|
||||||
|
MachinePortNameSSH MachinePortName = "ssh"
|
||||||
|
MachinePortNameVNC MachinePortName = "vnc"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PortProtocolTCP PortProtocol = "tcp"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MachinePort struct {
|
||||||
|
Name MachinePortName `json:"name"`
|
||||||
|
Port uint16 `json:"port"`
|
||||||
|
Protocol PortProtocol `json:"protocol"`
|
||||||
|
}
|
||||||
|
|
@ -27,8 +27,10 @@ type MachineRecord struct {
|
||||||
Artifact contracthost.ArtifactRef
|
Artifact contracthost.ArtifactRef
|
||||||
SystemVolumeID contracthost.VolumeID
|
SystemVolumeID contracthost.VolumeID
|
||||||
UserVolumeIDs []contracthost.VolumeID
|
UserVolumeIDs []contracthost.VolumeID
|
||||||
Phase contracthost.MachinePhase
|
|
||||||
RuntimeHost string
|
RuntimeHost string
|
||||||
|
TapDevice string
|
||||||
|
Ports []contracthost.MachinePort
|
||||||
|
Phase contracthost.MachinePhase
|
||||||
Error string
|
Error string
|
||||||
CreatedAt time.Time
|
CreatedAt time.Time
|
||||||
StartedAt *time.Time
|
StartedAt *time.Time
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue