SimpleRouter creates a basic RouterCfg with the given parameters
(id string, pubKey state.NyPublicKey, nylonIP string, endpointIP string)
| 527 | |
| 528 | // SimpleRouter creates a basic RouterCfg with the given parameters |
| 529 | func SimpleRouter(id string, pubKey state.NyPublicKey, nylonIP string, endpointIP string) state.RouterCfg { |
| 530 | cfg := state.RouterCfg{ |
| 531 | NodeCfg: state.NodeCfg{ |
| 532 | Id: state.NodeId(id), |
| 533 | PubKey: pubKey, |
| 534 | Addresses: []netip.Addr{ |
| 535 | netip.MustParseAddr(nylonIP), |
| 536 | }, |
| 537 | }, |
| 538 | } |
| 539 | if endpointIP != "" { |
| 540 | cfg.Endpoints = []*state.DynamicEndpoint{ |
| 541 | state.NewDynamicEndpoint(fmt.Sprintf("%s:57175", endpointIP)), |
| 542 | } |
| 543 | } |
| 544 | return cfg |
| 545 | } |
| 546 | |
| 547 | // SimpleLocal creates a basic LocalCfg with the given parameters and defaults |
| 548 | func SimpleLocal(id string, key state.NyPrivateKey) state.LocalCfg { |