Class: LittleGhost::Network::Gateway
- Inherits:
-
Object
- Object
- LittleGhost::Network::Gateway
- 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
Instance Attribute Summary collapse
-
#policy ⇒ Object
readonly
Network policy enforced by this gateway.
Instance Method Summary collapse
-
#client_network ⇒ Object
Returns an isolated container network name when applicable.
-
#close ⇒ Object
Stops owned resources.
-
#environment ⇒ Object
Returns child-process proxy and trust environment variables.
-
#initialize(policy:) ⇒ Gateway
constructor
Builds a gateway for a normalized network
policy. -
#mounts ⇒ Object
Returns read-only mounts required by child processes.
-
#open(run: nil) ⇒ Object
Starts run-scoped gateway resources.
-
#validate! ⇒ Object
Fails closed when the gateway is no longer ready for a child process.
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
#policy ⇒ Object (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_network ⇒ Object
Returns an isolated container network name when applicable.
93 |
# File 'lib/little_ghost/network.rb', line 93 def client_network = nil |
#close ⇒ Object
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. |
#environment ⇒ Object
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. |
#mounts ⇒ Object
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. |