Versions in this module Expand all Collapse all v0 v0.3.0 Aug 24, 2026 Changes in this version + var ErrDaemonTimeout = Unavailable(fmt.Errorf("fake: daemon timeout")) + var ErrImagePull = Unavailable(fmt.Errorf("fake: image pull failed")) + var ErrNetworkCreate = Unavailable(fmt.Errorf("fake: network create failed")) + var ErrPortBound = fmt.Errorf("fake: host port already bound") + func IsUnavailable(err error) bool + func Reconcile(observed []ContainerView, rows []InstanceRow, networks []NetworkView, ...) ([]Action, ReconcileStats) + func Unavailable(cause error) error + type Action struct + ContainerID string + InstanceID string + Kind ActionKind + NetworkID string + Reason string + type ActionKind int + const ActionFlagUnadopted + const ActionFlagUnadoptedNetwork + const ActionMarkLost + const ActionRemoveContainer + const ActionRemoveNetwork + type ChallengeRuntime interface + Deploy func(ctx context.Context, spec InstanceSpec) (Instance, error) + Destroy func(ctx context.Context, instanceID uuid.UUID) error + Logs func(ctx context.Context, instanceID uuid.UUID, tailLines int) (string, error) + Name func() string + Reconcile func(ctx context.Context) error + Status func(ctx context.Context, instanceID uuid.UUID) (Instance, error) + Stop func(ctx context.Context, instanceID uuid.UUID) error + type ContainerView struct + ContainerID string + InstanceID string + Running bool + type DeployReq struct + ChallengeID uuid.UUID + ExpiresAt *time.Time + Flag string + TeamID uuid.UUID + type DockerRuntime struct + func NewDockerRuntime(q *gen.Queries, log *slog.Logger, dockerHost string) (*DockerRuntime, error) + func (d *DockerRuntime) Deploy(ctx context.Context, spec InstanceSpec) (inst Instance, err error) + func (d *DockerRuntime) Destroy(ctx context.Context, instanceID uuid.UUID) error + func (d *DockerRuntime) ListUnadopted(ctx context.Context) ([]UnadoptedContainer, error) + func (d *DockerRuntime) ListUnadoptedNetworks(ctx context.Context) ([]UnadoptedNetwork, error) + func (d *DockerRuntime) Logs(ctx context.Context, instanceID uuid.UUID, tail int) (string, error) + func (d *DockerRuntime) Name() string + func (d *DockerRuntime) Reconcile(ctx context.Context) error + func (d *DockerRuntime) Status(ctx context.Context, instanceID uuid.UUID) (Instance, error) + func (d *DockerRuntime) Stop(ctx context.Context, instanceID uuid.UUID) error + func (d *DockerRuntime) VerifyIsolation(ctx context.Context) (bool, error) + type FakeRuntime struct + BeforeDeploy func(ctx context.Context, spec InstanceSpec) + DeployFault error + FailDeploy bool + FailReconcileActionFor func(a Action) bool + Unavailable bool + func NewFakeRuntime(q *gen.Queries) *FakeRuntime + func NewFakeRuntimeWithClock(q *gen.Queries, now func() time.Time) *FakeRuntime + func (f *FakeRuntime) ContainerIDs() []uuid.UUID + func (f *FakeRuntime) Deploy(ctx context.Context, spec InstanceSpec) (Instance, error) + func (f *FakeRuntime) DeployedSpecs() []InstanceSpec + func (f *FakeRuntime) Destroy(_ context.Context, instanceID uuid.UUID) error + func (f *FakeRuntime) DestroyedIDs() []uuid.UUID + func (f *FakeRuntime) ExitContainer(instanceID uuid.UUID) + func (f *FakeRuntime) InjectContainer(instanceID uuid.UUID, containerID string) + func (f *FakeRuntime) Logs(_ context.Context, instanceID uuid.UUID, _ int) (string, error) + func (f *FakeRuntime) Name() string + func (f *FakeRuntime) Reconcile(ctx context.Context) error + func (f *FakeRuntime) ReconcileActionCount() int + func (f *FakeRuntime) Status(ctx context.Context, instanceID uuid.UUID) (Instance, error) + func (f *FakeRuntime) Stop(ctx context.Context, instanceID uuid.UUID) error + func (f *FakeRuntime) VanishContainer(instanceID uuid.UUID) + type Instance struct + ChallengeID uuid.UUID + ContainerID string + Err string + ExpiresAt *time.Time + HostPort int + ID uuid.UUID + LastHealthAt *time.Time + Network string + StartedAt *time.Time + State State + TeamID *uuid.UUID + type InstanceRow struct + ContainerID string + InstanceID string + State string + TeamID string + UpdatedAt time.Time + type InstanceSpec struct + CPUMillis int + ChallengeID uuid.UUID + Env map[string]string + HostPort int + Image string + InstanceID uuid.UUID + InternalPort int + MemLimitMB int + NetworkName string + NoEgress bool + ReadonlyRootfs bool + Slug string + TeamID *uuid.UUID + Tmpfs []string + type Manager struct + func NewManager(rt ChallengeRuntime, q *gen.Queries, publicHost string, portStart, portEnd int) *Manager + func (m *Manager) ConfigureIsolationGate(allowUnisolated bool, log *slog.Logger) + func (m *Manager) ConnectionInfo(ch gen.Challenge, inst Instance) string + func (m *Manager) CountTeamRunning(ctx context.Context, teamID uuid.UUID) (int, error) + func (m *Manager) Deploy(ctx context.Context, challengeID uuid.UUID) (Instance, error) + func (m *Manager) DeployForTeam(ctx context.Context, req DeployReq) (Instance, error) + func (m *Manager) Destroy(ctx context.Context, challengeID uuid.UUID) error + func (m *Manager) DestroyForChallenge(ctx context.Context, challengeID uuid.UUID) error + func (m *Manager) DestroyInstance(ctx context.Context, instanceID uuid.UUID) error + func (m *Manager) Get(ctx context.Context, challengeID uuid.UUID) (Instance, bool, error) + func (m *Manager) GetTeamInstance(ctx context.Context, challengeID, teamID uuid.UUID) (Instance, bool, error) + func (m *Manager) InstanceForChallenge(ctx context.Context, challengeID uuid.UUID) (Instance, bool) + func (m *Manager) ListAll(ctx context.Context) ([]Instance, error) + func (m *Manager) ListStale(ctx context.Context, olderThan time.Duration) ([]Instance, error) + func (m *Manager) ListTeamInstances(ctx context.Context, teamID uuid.UUID) ([]Instance, error) + func (m *Manager) ListUnadopted(ctx context.Context) ([]UnadoptedContainer, error) + func (m *Manager) ListUnadoptedNetworks(ctx context.Context) ([]UnadoptedNetwork, error) + func (m *Manager) Logs(ctx context.Context, challengeID uuid.UUID, tail int) (string, error) + func (m *Manager) Reconcile(ctx context.Context) error + func (m *Manager) RecordIsolationVerdict(isolated bool) + func (m *Manager) Restart(ctx context.Context, challengeID uuid.UUID) (Instance, error) + func (m *Manager) Runtime() ChallengeRuntime + func (m *Manager) VerifyIsolation(ctx context.Context) (bool, error) + type NetworkView struct + Attached int + Name string + NetworkID string + TeamID string + TeamNetwork bool + type ReconcileStats struct + FutureRows int + SkippedGrace int + type State string + const StateError + const StateLost + const StatePending + const StateRunning + const StateStarting + const StateStopped + const StateUnhealthy + type UnadoptedContainer struct + ContainerID string + CreatedAt time.Time + Image string + type UnadoptedNetwork struct + Name string + NetworkID string v0.3.0-rc.1 Aug 23, 2026