Skip to content

Commit eaba61c

Browse files
committed
Small corrections.
1 parent 68389be commit eaba61c

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

src/MongoDB.Driver/Core/Configuration/ClusterBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public ClusterBuilder ConfigureTcp(Func<TcpStreamSettings, TcpStreamSettings> co
162162
/// Configures the SOCKS5 proxy settings for the cluster.
163163
/// </summary>
164164
/// <param name="configurator"> The SOCKS5 proxy settings configurator delegate.</param>
165-
/// <returns> A reconfigured cluster builder.</returns>
165+
/// <returns>A reconfigured cluster builder.</returns>
166166
public ClusterBuilder ConfigureSocks5Proxy(Func<Socks5ProxyStreamSettings, Socks5ProxyStreamSettings> configurator)
167167
{
168168
Ensure.IsNotNull(configurator, nameof(configurator));

src/MongoDB.Driver/Core/Configuration/Socks5ProxyStreamSettings.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace MongoDB.Driver.Core.Configuration;
2020
/// <summary>
2121
/// Represents settings for a SOCKS5 proxy stream.
2222
/// </summary>
23-
public class Socks5ProxyStreamSettings
23+
public sealed class Socks5ProxyStreamSettings
2424
{
2525
private Socks5ProxySettings _socks5ProxySettings;
2626

@@ -44,7 +44,5 @@ public Socks5ProxyStreamSettings(Optional<Socks5ProxySettings> socks5ProxySettin
4444
/// <param name="socks5ProxySettings"></param>
4545
/// <returns></returns>
4646
public Socks5ProxyStreamSettings With(Socks5ProxySettings socks5ProxySettings)
47-
{
48-
return new Socks5ProxyStreamSettings(socks5ProxySettings);
49-
}
47+
=> new(socks5ProxySettings);
5048
}

src/MongoDB.Driver/Core/Connections/Socks5Helper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static async Task PerformSocks5HandshakeAsync(Stream stream, EndPoint end
145145
await stream.ReadBytesAsync(buffer, 0, 2, cancellationToken).ConfigureAwait(false);
146146
var requiresAuthenticationStep = ProcessGreetingResponse(buffer, useAuth);
147147

148-
// If we have username and password, but the proxy doesn't need them, we skip.
148+
// If we have username and password, but the proxy doesn't need them, we skip the authentication step.
149149
if (requiresAuthenticationStep)
150150
{
151151
var authenticationRequestLength = CreateAuthenticationRequest(buffer, authenticationSettings);
@@ -289,7 +289,7 @@ private static int ProcessConnectResponse(byte[] buffer)
289289
AddressTypeIPv4 => 5,
290290
AddressTypeIPv6 => 17,
291291
AddressTypeDomain => buffer[4] + 2,
292-
_ => throw new IOException("Unknown address type in SOCKS5 reply.")
292+
_ => throw new IOException($"Unknown address type in SOCKS5 reply: {buffer[3]}.")
293293
};
294294
}
295295

src/MongoDB.Driver/MongoUrlBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ public string Password
448448
}
449449

450450
/// <summary>
451-
///
451+
/// Gets or sets the proxy host.
452452
/// </summary>
453453
public string ProxyHost
454454
{
@@ -460,7 +460,7 @@ public string ProxyHost
460460
}
461461

462462
/// <summary>
463-
///
463+
/// Gets or sets the proxy port.
464464
/// </summary>
465465
/// <exception cref="ArgumentOutOfRangeException"></exception>
466466
public int? ProxyPort
@@ -473,7 +473,7 @@ public int? ProxyPort
473473
}
474474

475475
/// <summary>
476-
///
476+
/// Gets or sets the proxy username.
477477
/// </summary>
478478
public string ProxyUsername
479479
{
@@ -485,7 +485,7 @@ public string ProxyUsername
485485
}
486486

487487
/// <summary>
488-
///
488+
/// Gets or sets the proxy password.
489489
/// </summary>
490490
public string ProxyPassword
491491
{

tests/MongoDB.Driver.Tests/Specifications/socks5-support/Socks5SupportProseTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public static IEnumerable<object[]> GetTestCombinations()
7575
});
7676
}
7777

78+
//Prose test: https://github.com/mongodb/specifications/blob/a6dbd208462d97f97c813560cac5cf25925bb0cf/source/socks5-support/tests/README.md
7879
[Theory]
7980
[MemberData(nameof(GetTestCombinations))]
8081
public async Task TestConnectionStrings(string id, string connectionString, bool expectedResult, bool useTls, bool async)

0 commit comments

Comments
 (0)