Documentation
¶
Overview ¶
Package fake is an in-memory TunnelBackend for tests and development without root or the pinned AWG tooling. It models the semantics the real implementation is held to: setconf-style full replace, syncconf-style peer diff, dump observation, and interface existence. It is race-safe (exercised under -race) and records applied operations for assertions.
Index ¶
- type Backend
- func (b *Backend) ApplyInterfaceConfig(_ context.Context, name string, cfg tunnel.InterfaceConfig) error
- func (b *Backend) CreateInterface(_ context.Context, spec tunnel.InterfaceSpec) error
- func (b *Backend) Dump(_ context.Context, name string) (tunnel.InterfaceState, error)
- func (b *Backend) EnsureAddresses(_ context.Context, name string, addresses []string) error
- func (b *Backend) ListInterfaces(context.Context) ([]string, error)
- func (b *Backend) Ops() []Op
- func (b *Backend) RemoveInterface(_ context.Context, name string) error
- func (b *Backend) ResetOps()
- func (b *Backend) SetObfuscation(name string, o tunnel.Obfuscation) error
- func (b *Backend) SetPeerActivity(name, publicKey string, handshake time.Time, rx, tx uint64) error
- func (b *Backend) SetPublicKey(name, publicKey string) error
- func (b *Backend) Spec(name string) (tunnel.InterfaceSpec, bool)
- func (b *Backend) SyncPeers(_ context.Context, name string, peers []tunnel.PeerConfig) error
- type Op
- type OpKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// FailOn makes the next operation of that kind return an error
// (failure-injection for reconcile/rollback tests).
FailOn map[OpKind]error
// contains filtered or unexported fields
}
Backend is the fake implementation.
func (*Backend) ApplyInterfaceConfig ¶
func (*Backend) CreateInterface ¶
func (*Backend) EnsureAddresses ¶ added in v0.1.8
func (*Backend) ListInterfaces ¶
func (*Backend) RemoveInterface ¶
func (*Backend) SetObfuscation ¶
func (b *Backend) SetObfuscation(name string, o tunnel.Obfuscation) error
SetObfuscation simulates foreign drift on the interface parameters (the panel does not expose in-place edits; tests use it to drive the mode-transition recreate path).
func (*Backend) SetPeerActivity ¶
SetPeerActivity simulates handshakes and counters (accounting tests).
func (*Backend) SetPublicKey ¶
SetPublicKey sets the interface public key shown in Dump (the fake cannot derive it from the private key; tests assert on it explicitly).