lazydns

Goto Plugin

goto is a control-flow plugin used inside sequences to transfer execution to another sequence. It implements “replace” semantics: when a plugin sets a goto target the current sequence stops and the plugin system replaces it with the target sequence.

Arguments

Usage

There are two common ways to invoke goto inside a sequence:

# sequence: main
- exec: goto special_handling
# sequence: main
- exec:
    goto: special_handling

Both forms instruct the runtime to replace the current sequence with the sequence named special_handling.

Behavior

Example

A simple example showing goto used to route DNS queries that match a condition into an alternative path:

plugins:
  - tag: main
    type: sequence
    args:
      - matches: qname $dns_sd_rules
        exec: goto dns_sd_sink
      - exec: $upstream

  - tag: dns_sd_sink
    type: sequence
    args:
      - exec: dbg queries
      - exec: black_hole 127.0.0.1
      - exec: accept

Execution for a matching query:

Differences vs jump

Implementation notes

Notes