| 801 | } |
| 802 | |
| 803 | void RouterContext::SetReachable (bool v4, bool v6) |
| 804 | { |
| 805 | if (v4 || (v6 && !SupportsV4 ())) |
| 806 | { |
| 807 | // update caps |
| 808 | uint8_t caps = m_RouterInfo.GetCaps (); |
| 809 | caps &= ~i2p::data::RouterInfo::eUnreachable; |
| 810 | caps |= i2p::data::RouterInfo::eReachable; |
| 811 | if (m_IsFloodfill) |
| 812 | caps |= i2p::data::RouterInfo::eFloodfill; |
| 813 | m_RouterInfo.UpdateCaps (caps); |
| 814 | } |
| 815 | uint16_t port = 0; |
| 816 | // delete previous introducers |
| 817 | bool isSSU2Published; i2p::config::GetOption ("ssu2.published", isSSU2Published); |
| 818 | auto addresses = m_RouterInfo.GetAddresses (); |
| 819 | if (addresses) |
| 820 | { |
| 821 | for (auto& addr : *addresses) |
| 822 | if (addr && addr->ssu && isSSU2Published && ((v4 && addr->IsV4 ()) || (v6 && addr->IsV6 ()))) |
| 823 | { |
| 824 | addr->published = true; |
| 825 | UpdateSSU2AddressCapsIntroducer (addr, !m_IsFloodfill); |
| 826 | addr->ssu->introducers.clear (); |
| 827 | if (addr->port) port = addr->port; |
| 828 | } |
| 829 | } |
| 830 | // publish NTCP2 |
| 831 | bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2); |
| 832 | if (ntcp2) |
| 833 | { |
| 834 | bool published; i2p::config::GetOption ("ntcp2.published", published); |
| 835 | if (published) |
| 836 | { |
| 837 | uint16_t ntcp2Port; i2p::config::GetOption ("ntcp2.port", ntcp2Port); |
| 838 | if (!ntcp2Port) ntcp2Port = port; |
| 839 | int ntcp2version = 2; |
| 840 | #if OPENSSL_PQ |
| 841 | i2p::config::GetOption("ntcp2.version", ntcp2version); |
| 842 | #endif |
| 843 | PublishNTCP2Address (ntcp2Port, true, v4, v6, false, ntcp2version); |
| 844 | } |
| 845 | } |
| 846 | // update |
| 847 | m_RouterInfo.UpdateSupportedTransports (); |
| 848 | UpdateRouterInfo (); |
| 849 | } |
| 850 | |
| 851 | void RouterContext::SetSupportsV6 (bool supportsV6) |
| 852 | { |
nothing calls this directly
no test coverage detected