ipc

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowDomainHandlerConfig

type AllowDomainHandlerConfig struct {
	Runtime       container.Runtime
	ContainerName string
	// PromptFunc overrides the tmux popup prompt for testing.
	PromptFunc func(domain string) (bool, error)
	// ReloadFunc overrides domain reload for testing.
	ReloadFunc func(domain string) error
}

AllowDomainHandlerConfig holds dependencies for the allow_domain handler.

type AllowDomainRequest

type AllowDomainRequest struct {
	Domain string `json:"domain"`
}

AllowDomainRequest is the payload for "allow_domain" requests.

type AllowDomainResponse

type AllowDomainResponse struct {
	Approved bool   `json:"approved"`
	Error    string `json:"error,omitempty"`
}

AllowDomainResponse is the payload for "allow_domain" responses.

type HandlerFunc

type HandlerFunc func(req *Request) (interface{}, error)

HandlerFunc processes an IPC request and returns a response payload.

func NewAllowDomainHandler

func NewAllowDomainHandler(cfg AllowDomainHandlerConfig) HandlerFunc

NewAllowDomainHandler returns a HandlerFunc that validates a domain, prompts the user via a tmux popup in the container, and hot-reloads Squid on approval.

type Request

type Request struct {
	Type    string          `json:"type"`
	ID      string          `json:"id"`
	Payload json.RawMessage `json:"payload"`
}

Request is a message sent from the container to the host.

type Response

type Response struct {
	Type    string      `json:"type"`
	ID      string      `json:"id"`
	Payload interface{} `json:"payload"`
}

Response is a message sent from the host back to the container.

type Server

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

Server listens on a Unix domain socket and dispatches JSON-lines messages.

func NewServer

func NewServer() (*Server, error)

NewServer creates a new IPC server with a temporary socket directory.

func (*Server) Handle

func (s *Server) Handle(msgType string, h HandlerFunc)

Handle registers a handler for a message type.

func (*Server) SocketDir

func (s *Server) SocketDir() string

SocketDir returns the directory containing the socket (for container mount).

func (*Server) Start

func (s *Server) Start()

Start begins accepting connections in a background goroutine.

func (*Server) Stop

func (s *Server) Stop()

Stop closes the listener, waits for goroutines, and removes the socket dir.

Jump to

Keyboard shortcuts

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