diff --git a/CONFIG.md b/CONFIG.md index c3c7eff..426c88b 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -345,6 +345,7 @@ and multiple entries are permitted. * **RelayName** - name of the Azure Relay name to bind to * **ConnectionString** - optional Azure Relay connection string to use just for this forwarder, overriding the global **AzureRelayConnectionString** property. +* **NoAuthentication** - optional, if set to true, the connection is made without authentication with the assumption that the hybrid connection is configured to not require it. For a single port binding on the Relay name, the following properties can be used on the same entry. For multiple bindings they can be used to form a list. @@ -359,20 +360,32 @@ Examples: - Single listener binding: ``` YAML - - RelayName: myrelay - BindAddress: 127.0.8.1 - BindPort: 8888 + LocalForward: + - RelayName: myrelay + BindAddress: 127.0.8.1 + BindPort: 8888 ``` + +- Single listener binding (no client authentication): + ``` YAML + LocalForward: + - RelayName: myrelay + BindAddress: 127.0.8.1 + BindPort: 8888 + NoAuthentication: true + ``` + - Multiple listener binding: ``` YAML - - RelayName: myrelay - Bindings: - - BindAddress: 127.0.8.1 - BindPort: 5671 - PortName: amqps - - BindAddress: 127.0.8.1 - BindPort: 5672 - PortName: amqp + LocalForward: + - RelayName: myrelay + Bindings: + - BindAddress: 127.0.8.1 + BindPort: 5671 + PortName: amqps + - BindAddress: 127.0.8.1 + BindPort: 5672 + PortName: amqp ``` @@ -410,12 +423,15 @@ Examples: - Single listener binding: ``` YAML + RemoteForward: - RelayName: myrelay Host: localhost HostPort: 8888 ``` + - Multiple listener binding: ``` YAML + RemoteForward: - RelayName: myrelay Bindings: - Host: broker.corp.example.com diff --git a/test/unit/Microsoft.Azure.Relay.Bridge.Tests/ConfigTest.cs b/test/unit/Microsoft.Azure.Relay.Bridge.Tests/ConfigTest.cs index a5ebab1..369c78c 100644 --- a/test/unit/Microsoft.Azure.Relay.Bridge.Tests/ConfigTest.cs +++ b/test/unit/Microsoft.Azure.Relay.Bridge.Tests/ConfigTest.cs @@ -79,6 +79,11 @@ string CreateMaxConfig() " BindPort : 8008" + textWriter.NewLine + " RelayName : bar" + textWriter.NewLine + " HostName : bar.example.com" + textWriter.NewLine + + " - BindAddress : 127.0.100.3" + textWriter.NewLine + + " BindPort : 8008" + textWriter.NewLine + + " RelayName : bam" + textWriter.NewLine + + " HostName : bam.example.com" + textWriter.NewLine + + " NoAuthentication: true" + textWriter.NewLine + #if !NETFRAMEWORK " - BindLocalSocket : test" + textWriter.NewLine + " RelayName : baz" + textWriter.NewLine + @@ -786,27 +791,33 @@ private static void CheckMaxConfig(Config config) Assert.True(config.ExitOnForwardFailure); #if !NETFRAMEWORK - Assert.Equal(3, config.LocalForward.Count); + Assert.Equal(4, config.LocalForward.Count); #else - Assert.Equal(2, config.LocalForward.Count); + Assert.Equal(3, config.LocalForward.Count); #endif Assert.Equal("127.0.100.1", config.LocalForward[0].BindAddress); Assert.Equal(8008, config.LocalForward[0].BindPort); Assert.Equal("foo", config.LocalForward[0].RelayName); Assert.Equal("foo.example.com", config.LocalForward[0].HostName); + Assert.False(config.LocalForward[0].NoAuthentication); Assert.Equal("127.0.100.2", config.LocalForward[1].BindAddress); Assert.Equal(8008, config.LocalForward[1].BindPort); Assert.Equal("bar", config.LocalForward[1].RelayName); Assert.Equal("bar.example.com", config.LocalForward[1].HostName); + Assert.False(config.LocalForward[1].NoAuthentication); + Assert.Equal("127.0.100.3", config.LocalForward[2].BindAddress); + Assert.Equal(8008, config.LocalForward[2].BindPort); + Assert.Equal("bam", config.LocalForward[2].RelayName); + Assert.True(config.LocalForward[2].NoAuthentication); #if !NETFRAMEWORK - Assert.Equal("test", config.LocalForward[2].BindLocalSocket); - Assert.Equal("baz", config.LocalForward[2].RelayName); + Assert.Equal("test", config.LocalForward[3].BindLocalSocket); + Assert.Equal("baz", config.LocalForward[3].RelayName); #endif #if !NETFRAMEWORK Assert.Equal(3, config.RemoteForward.Count); #else - Assert.Equal(2, config.RemoteForward.Count); + Assert.Equal(4, config.RemoteForward.Count); #endif Assert.Equal("foo", config.RemoteForward[0].RelayName); Assert.Equal(123, config.RemoteForward[0].HostPort); @@ -830,7 +841,7 @@ public void ConfigSaveLoadFileTest() Config config = Config.LoadConfig(settings); config.SaveConfigFile(configFileName, false); - + config = Config.LoadConfigFile(configFileName); CheckMaxConfig(config);