| 123 | } |
| 124 | |
| 125 | func (v *VirtualHarness) NewNode(id state.NodeId, virtPrefix string) { |
| 126 | privKey := state.GenerateKey() |
| 127 | locCfg := state.LocalCfg{ |
| 128 | Key: privKey, |
| 129 | Id: id, |
| 130 | Port: 25565, |
| 131 | NoNetConfigure: true, |
| 132 | UseSystemRouting: !v.UntrackedRouting, |
| 133 | } |
| 134 | ncfg := state.RouterCfg{ |
| 135 | NodeCfg: state.NodeCfg{ |
| 136 | Id: id, |
| 137 | PubKey: privKey.Pubkey(), |
| 138 | Prefixes: []state.PrefixHealthWrapper{ |
| 139 | { |
| 140 | &state.StaticPrefixHealth{ |
| 141 | Prefix: netip.MustParsePrefix(virtPrefix), |
| 142 | Metric: 0, |
| 143 | }, |
| 144 | }, |
| 145 | }, |
| 146 | }, |
| 147 | } |
| 148 | v.Central.Routers = append(v.Central.Routers, ncfg) |
| 149 | v.Local = append(v.Local, locCfg) |
| 150 | } |
| 151 | |
| 152 | func (v *VirtualHarness) AddLink(from, to string) *VirtualLink { |
| 153 | link := &VirtualLink{} |