network

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package network manages Docker networks owned by workspaces. The platform owns the full lifecycle: each workspace gets a default network on creation, and the Docker network is created/removed alongside the database record.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameRequired  = errors.New("network name is required")
	ErrNameTaken     = errors.New("a network with this name already exists")
	ErrNotFound      = errors.New("network not found")
	ErrInUse         = errors.New("network is attached to one or more applications")
	ErrIsDefault     = errors.New("the default network cannot be deleted")
	ErrInvalidDriver = errors.New("unsupported network driver")
)

Functions

This section is empty.

Types

type Input

type Input struct {
	// Name is the desired unique slug handle; it is normalized to canonical slug
	// form. DisplayName is the free-text label (falls back to Name when blank).
	Name        string
	DisplayName string
	Driver      string
	Internal    bool
}

type Service

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

func NewService

func NewService(repo *repositories.NetworkRepository, dockerClient docker.Client) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, workspaceID uint, in Input) (*models.Network, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, workspaceID, id uint) error

func (*Service) EnsureDefault

func (s *Service) EnsureDefault(ctx context.Context, workspaceID uint) (*models.Network, error)

EnsureDefault creates the workspace's default network if it has none.

func (*Service) Get

func (s *Service) Get(workspaceID, id uint) (*models.Network, error)

func (*Service) List

func (s *Service) List(workspaceID uint) ([]models.Network, error)

func (*Service) SetAllocator

func (s *Service) SetAllocator(a *netalloc.Service)

SetAllocator wires the subnet allocator so managed networks get a Miabi-carved subnet instead of Docker's default pool (nil-safe; nil = Docker default pool).

func (*Service) SetQuota

func (s *Service) SetQuota(q *quota.Service)

SetQuota wires the plan/quota enforcer (nil-safe; nil skips checks).

Jump to

Keyboard shortcuts

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