Skip to content

Commit e1dc351

Browse files
authored
Merge pull request #122 from MatrixAI/feature-configurable-serverName
Adding `serverName` option to `CreateQUICClient`
2 parents 02f2e07 + 4b7029e commit e1dc351

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/QUICClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class QUICClient {
4040
* @param opts
4141
* @param opts.host - target host where wildcards are resolved to point locally.
4242
* @param opts.port - target port
43+
* @param opts.serverName - The expected name of the server you are connecting to, defaults to host.
4344
* @param opts.localHost - defaults to `::` (dual-stack)
4445
* @param opts.localPort - defaults 0
4546
* @param opts.socket - optional shared QUICSocket
@@ -63,6 +64,7 @@ class QUICClient {
6364
opts: {
6465
host: string;
6566
port: number;
67+
serverName?: string;
6668
localHost?: string;
6769
localPort?: number;
6870
crypto: QUICClientCrypto;
@@ -80,6 +82,7 @@ class QUICClient {
8082
opts: {
8183
host: string;
8284
port: number;
85+
serverName?: string;
8386
socket: QUICSocket;
8487
crypto: QUICClientCrypto;
8588
config?: QUICClientConfigInput;
@@ -96,6 +99,7 @@ class QUICClient {
9699
{
97100
host,
98101
port,
102+
serverName,
99103
localHost = '::',
100104
localPort = 0,
101105
socket,
@@ -110,6 +114,7 @@ class QUICClient {
110114
}: {
111115
host: string;
112116
port: number;
117+
serverName?: string;
113118
localHost?: string;
114119
localPort?: number;
115120
socket?: QUICSocket;
@@ -186,7 +191,7 @@ class QUICClient {
186191
connection = new QUICConnection({
187192
type: 'client',
188193
scid,
189-
serverName: host,
194+
serverName: serverName ?? host,
190195
socket,
191196
remoteInfo: {
192197
host: host_,

0 commit comments

Comments
 (0)