rsyslog-config: Support IPv6 address
The IPv6 address requires `[]` in the config file. Add support for this
format so that user could set IPv6 address on DBus, and this service
will add `[]` in the config file to make it work correctly.
Split the logic in restore() into a separate function parseConfig() so
that it is easier to test.
Tested: Verify both IPv4 and IPv6 address could be set to rsyslog-config
and verify it works correctly.
Added several IPv6 related test cases.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I2135e3b0e916947449ab5d0cfa9669a98349226e
diff --git a/test/remote_logging_test_address.cpp b/test/remote_logging_test_address.cpp
index 16d560c..274ac7c 100644
--- a/test/remote_logging_test_address.cpp
+++ b/test/remote_logging_test_address.cpp
@@ -14,6 +14,9 @@
{
config->address("1.1.1.1");
EXPECT_EQ(config->address(), "1.1.1.1");
+
+ config->address("abcd:ef01::01");
+ EXPECT_EQ(config->address(), "abcd:ef01::01");
}
TEST_F(TestRemoteLogging, testBadAddress)