[ntcore] Add ability to announce mDNS for server (#8373)

We can use this as a new way of resolving addresses.
This commit is contained in:
Thad House
2025-12-16 22:26:56 -08:00
committed by GitHub
parent 7cb58962c5
commit e2d492ac3f
27 changed files with 133 additions and 56 deletions

View File

@@ -39,7 +39,7 @@ class ConnectionListenerTest {
/** Connect to the server. */
private void connect(int port) {
m_serverInst.startServer("connectionlistenertest.json", "127.0.0.1", port);
m_serverInst.startServer("connectionlistenertest.json", "127.0.0.1", "", port);
m_clientInst.startClient("client");
m_clientInst.setServer("127.0.0.1", port);
@@ -113,7 +113,7 @@ class ConnectionListenerTest {
@ParameterizedTest
@ValueSource(strings = {"127.0.0.1", "127.0.0.1 ", " 127.0.0.1 "})
void testThreaded(String address) {
m_serverInst.startServer("connectionlistenertest.json", address, threadedPort);
m_serverInst.startServer("connectionlistenertest.json", address, "", threadedPort);
List<NetworkTableEvent> events = new ArrayList<>();
final int handle =
m_serverInst.addConnectionListener(

View File

@@ -37,7 +37,7 @@ class TimeSyncTest {
try (var poller = new NetworkTableListenerPoller(m_inst)) {
poller.addTimeSyncListener(false);
m_inst.startServer("timesynctest.json", "127.0.0.1", 10030);
m_inst.startServer("timesynctest.json", "127.0.0.1", "", 10030);
var offset = m_inst.getServerTimeOffset();
assertTrue(offset.isPresent());
assertEquals(0L, offset.getAsLong());

View File

@@ -33,7 +33,7 @@ class TopicListenerTest {
}
private void connect() {
m_serverInst.startServer("topiclistenertest.json", "127.0.0.1", 10010);
m_serverInst.startServer("topiclistenertest.json", "127.0.0.1", "", 10010);
m_clientInst.startClient("client");
m_clientInst.setServer("127.0.0.1", 10010);

View File

@@ -32,7 +32,7 @@ class ConnectionListenerTest : public ::testing::Test {
};
void ConnectionListenerTest::Connect(const char* address, unsigned int port4) {
wpi::nt::StartServer(server_inst, "connectionlistenertest.ini", address,
wpi::nt::StartServer(server_inst, "connectionlistenertest.ini", address, "",
port4);
wpi::nt::StartClient(client_inst, "client");
wpi::nt::SetServer(client_inst, address, port4);

View File

@@ -26,7 +26,7 @@ TEST_F(TimeSyncTest, TestServer) {
wpi::nt::NetworkTableListenerPoller poller{m_inst};
poller.AddTimeSyncListener(false);
m_inst.StartServer("timesynctest.json", "127.0.0.1", 10030);
m_inst.StartServer("timesynctest.json", "127.0.0.1", "", 10030);
auto offset = m_inst.GetServerTimeOffset();
ASSERT_TRUE(offset);
ASSERT_EQ(0, *offset);

View File

@@ -52,7 +52,7 @@ class TopicListenerTest : public ::testing::Test {
};
void TopicListenerTest::Connect(unsigned int port) {
wpi::nt::StartServer(m_serverInst, "topiclistenertest.json", "127.0.0.1",
wpi::nt::StartServer(m_serverInst, "topiclistenertest.json", "127.0.0.1", "",
port);
wpi::nt::StartClient(m_clientInst, "client");
wpi::nt::SetServer(m_clientInst, "127.0.0.1", port);