WithAddressRewriteRules appends the provided address rewrite (1:1) rules to the agent's existing configuration. Each `AddressRewriteRule` can limit the mapping to a specific interface (`Iface`), local address (`Local`), CIDR block (`CIDR`), or subset of network types (`Networks`), allowing fine-grai
(rules ...AddressRewriteRule)
| 49 | // iface-only, then global) while still keeping rule order meaningful. |
| 50 | // Overlapping rules in the same scope are logged as warnings. |
| 51 | func WithAddressRewriteRules(rules ...AddressRewriteRule) AgentOption { |
| 52 | return func(agent *Agent) error { |
| 53 | if agent.constructed { |
| 54 | return ErrAgentOptionNotUpdatable |
| 55 | } |
| 56 | |
| 57 | return appendAddressRewriteRules(agent, rules...) |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | func warnOnAddressRewriteConflicts(agent *Agent) { |
| 62 | if agent == nil || agent.log == nil { |
searching dependent graphs…