Class: LittleGhost::Network::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/little_ghost/network.rb

Overview

Lifecycle contract implemented by filtered-egress gateways. A Gateway is one part of enforcement; the Sandbox must also prevent direct networking.

Direct Known Subclasses

EnvoyGateway, ExternalGateway

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(policy:) ⇒ Gateway

Builds a gateway for a normalized network policy.



75
76
77
# File 'lib/little_ghost/network.rb', line 75

def initialize(policy:)
  @policy = policy
end

Instance Attribute Details

#policyObject (readonly)

Network policy enforced by this gateway.



80
81
82
# File 'lib/little_ghost/network.rb', line 80

def policy
  @policy
end

Instance Method Details

#client_networkObject

Returns an isolated container network name when applicable.



93
# File 'lib/little_ghost/network.rb', line 93

def client_network = nil

#closeObject

Stops owned resources. Calling close more than once must be safe.



85
86
# File 'lib/little_ghost/network.rb', line 85

def close = nil
# Fails closed when the gateway is no longer ready for a child process.

#environmentObject

Returns child-process proxy and trust environment variables.



89
90
# File 'lib/little_ghost/network.rb', line 89

def environment = {}.freeze
# Returns read-only mounts required by child processes.

#mountsObject

Returns read-only mounts required by child processes.



91
92
# File 'lib/little_ghost/network.rb', line 91

def mounts = [].freeze
# Returns an isolated container network name when applicable.

#open(run: nil) ⇒ Object

Starts run-scoped gateway resources.



83
84
# File 'lib/little_ghost/network.rb', line 83

def open(run: nil) = self
# Stops owned resources. Calling +close+ more than once must be safe.

#validate!Object

Fails closed when the gateway is no longer ready for a child process.



87
88
# File 'lib/little_ghost/network.rb', line 87

def validate! = self
# Returns child-process proxy and trust environment variables.