Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit b5919b7

Browse files
committed
Fix linting problems in portal code
1 parent 0379a2e commit b5919b7

35 files changed

+456
-188
lines changed

doc/certificates.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Client side certificate management
2+
3+
We recommand to use default credential storage to verify and manage certificates on different platforms.
4+
Windows: (https://docs.microsoft.com/en-us/windows-hardware/drivers/install/certificate-stores)
5+
IOS: (https://developer.apple.com/documentation/security/certificate_key_and_trust_services/certificates)
6+
Android: (https://developer.android.com/training/articles/security-config)

doc/design/quic-programming-guide.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ Please follow [Conference Server build instructions](https://github.com/open-web
126126
Steps to run Conference Server with pre-built binary:
127127

128128
1. Go to the untarred conference server dir, and run `./bin/init-all.sh --deps`; this would try to install mongodb and rabbitmq-server. Don't set any password for rabbitmq or mongodb.
129-
2. Still in the same dir, run `bin/init-all.sh`.
130-
3. Update quic_agent/agent.toml, set `hostname` to the hostname quic agent is running on.
131-
4. run `bin/start-all.sh`.
132-
5. Open [https://localhost:3004/quic.html](https://localhost:3004/quic.html) on the same host with Chrome browser to visit the web sample page. Due to the test certificate, you may need confirm this unsafe access.
133-
6. Press 'Start Sending' button to start transferring data to conference server. Press 'Stop Sending' button on the web page to stop sending.. If there's no error in the console, that implies server is correctly setup.
129+
1. Still in the same dir, run `bin/init-all.sh`.
130+
1. Update quic_agent/agent.toml, set `hostname` to the hostname quic agent is running on.
131+
1. Update management_api/management_api.toml, set `enableWebTransport` to `true`.
132+
1. run `bin/start-all.sh`.
133+
1. Open [https://localhost:3004/quic.html](https://localhost:3004/quic.html) on the same host with Chrome browser to visit the web sample page. Due to the test certificate, you may need confirm this unsafe access.
134+
1. Press 'Start Sending' button to start transferring data to conference server. Press 'Stop Sending' button on the web page to stop sending.. If there's no error in the console, that implies server is correctly setup.
134135

135136
# OWT QUIC Windows Sample
136137

@@ -152,7 +153,7 @@ OWT Conference Server is using a self-signed certificate during development phas
152153
- Make sure generate-certs.sh is exectuable. If not, run `chmod +x generate-certs.sh`;
153154
- Remove the `out` dir in case it exists.
154155
- Under the downloaded tool dir, run `./generate-certs.sh`. It is expected to generate a series of files under out dir.
155-
- Under the downloaded tool dir, run `openssl pkcs12 -inkey out/leaf_certs.key -in out/leaf_cert.pem -export -out out/certificate.pfx`. This will prompt for password for the pfx. Make sure you always use `abc123` as the password.
156+
- Under the downloaded tool dir, run `openssl pkcs12 -inkey out/leaf_cert.key -in out/leaf_cert.pem -export -out out/certificate.pfx`. This will prompt for password for the pfx. Make sure you always use `abc123` as the password.
156157
- Under the downloaded tool dir, run `openssl x509 -noout -fingerprint -sha256 -inform pem -in out/leaf_cert.pem`. You will get the fingerprint string in the form of "XX:XX:XX....XX:XX".
157158

158159
## Use the Certificate

scripts/pack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ function isLibAllowed(libSrc) {
456456
const whiteList = [
457457
'rtcadapter',
458458
'libssl.so.1.1',
459-
'libcrypto',
459+
'libcrypto.so.1.1',
460460
'libnice',
461461
'libSvtHevcEnc',
462462
'libusrsctp',

source/.eslintrc.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1+
// Copyright (C) <2018> Intel Corporation
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
14
{
25
"env": {
3-
"browser": true,
4-
"es2021": true
6+
"es2021": true,
7+
"node": true
58
},
6-
"extends": "eslint:recommended",
9+
"extends": ["eslint:recommended", "google"],
710
"parserOptions": {
8-
"ecmaVersion": 12,
9-
"sourceType": "module"
11+
"ecmaVersion": 12,
12+
"sourceType": "module"
1013
},
1114
"rules": {
15+
"max-len": ["error", {
16+
// This line is part of the MIT license.
17+
"ignorePattern": "The above copyright notice and this permission notice shall be included in all",
18+
// Some lines for JSDoc is longer than 80.
19+
"ignoreComments": true
20+
}],
21+
"indent": ["warn"],
22+
"camelcase": 0,
23+
"prefer-promise-reject-errors": "off",
24+
"guard-for-in": "off",
25+
"require-jsdoc": "off",
26+
"no-invalid-this": "off",
27+
"new-cap": "off"
1228
}
1329
}

source/agent/InternalConnectionFactory.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ try {
3939
}
4040

4141
// Wrapper object for sctp-connection and tcp/udp-connection
42-
function InConnection(prot, minport, maxport) {
42+
function InConnection(prot, minport, maxport, ticket) {
4343
var conn = null;
4444
var protocol = "quic";
4545

4646
switch (prot) {
4747
case 'tcp':
4848
case 'udp':
4949
protocol = prot;
50-
conn = new InternalIn(prot, minport, maxport);
50+
conn = new InternalIn(prot, minport, maxport, ticket);
5151
break;
5252
case 'quic':
5353
conn = new quicIO.in(cf, kf);
@@ -78,7 +78,7 @@ function InConnection(prot, minport, maxport) {
7878
}
7979

8080
// Wrapper object for sctp-connection and tcp/udp-connection
81-
function OutConnection(prot, minport, maxport) {
81+
function OutConnection(prot, minport, maxport, ticket) {
8282
var that = {};
8383
var conn = null;
8484
var protocol = "quic";
@@ -111,7 +111,7 @@ function OutConnection(prot, minport, maxport) {
111111
} else if (protocol === 'quic') {
112112
conn = new quicIO.out(connectOpt.ip, connectOpt.port);
113113
} else {
114-
conn = new InternalOut(protocol, connectOpt.ip, connectOpt.port);
114+
conn = new InternalOut(protocol, connectOpt.ip, connectOpt.port, ticket);
115115
}
116116
};
117117

@@ -139,6 +139,7 @@ module.exports = function() {
139139
var prot = internalOpt.protocol;
140140
var minport = internalOpt.minport || 0;
141141
var maxport = internalOpt.maxport || 0;
142+
var ticket = internalOpt.ticket;
142143

143144
if (preparedSet[connId]) {
144145
log.warn('Internal Connection already prepared:', connId);
@@ -147,7 +148,9 @@ module.exports = function() {
147148
// right call sequence in upper layer.
148149
return preparedSet[connId].connection.getListeningPort();
149150
}
150-
var conn = (direction === 'in')? InConnection(prot, minport, maxport) : OutConnection(prot, minport, maxport);
151+
var conn = (direction === 'in')
152+
? InConnection(prot, minport, maxport, ticket)
153+
: OutConnection(prot, minport, maxport, ticket);
151154

152155
preparedSet[connId] = {connection: conn, direction: direction};
153156
return conn.getListeningPort();

source/agent/addons/internalIO/InternalInWrapper.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,23 @@ void InternalIn::New(const FunctionCallbackInfo<Value>& args) {
3737
String::Utf8Value param0(args[0]->ToString());
3838
std::string protocol = std::string(*param0);
3939
unsigned int minPort = 0, maxPort = 0;
40+
std::string ticket;
4041

4142
if (args.Length() >= 3) {
4243
minPort = args[1]->Uint32Value();
4344
maxPort = args[2]->Uint32Value();
4445
}
46+
if (args.Length() > 3) {
47+
String::Utf8Value param3(args[3]->ToString());
48+
ticket = std::string(*param3);
49+
}
4550

4651
InternalIn* obj = new InternalIn();
47-
obj->me = new owt_base::InternalIn(protocol, minPort, maxPort);
52+
if (ticket.empty()) {
53+
obj->me = new owt_base::InternalIn(protocol, minPort, maxPort);
54+
} else {
55+
obj->me = new owt_base::InternalIn(protocol, ticket, minPort, maxPort);
56+
}
4857
obj->src = obj->me;
4958

5059
obj->Wrap(args.This());

source/agent/addons/internalIO/InternalOutWrapper.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,18 @@ void InternalOut::New(const v8::FunctionCallbackInfo<v8::Value>& args) {
3636
String::Utf8Value param1(args[1]->ToString());
3737
std::string dest_ip = std::string(*param1);
3838
unsigned int dest_port = args[2]->Uint32Value();
39+
std::string ticket;
40+
if (args.Length() > 3) {
41+
String::Utf8Value param3(args[3]->ToString());
42+
ticket = std::string(*param3);
43+
}
3944

4045
InternalOut* obj = new InternalOut();
41-
obj->me = new owt_base::InternalOut(protocol, dest_ip, dest_port);
46+
if (ticket.empty()) {
47+
obj->me = new owt_base::InternalOut(protocol, dest_ip, dest_port);
48+
} else {
49+
obj->me = new owt_base::InternalOut(protocol, ticket, dest_ip, dest_port);
50+
}
4251
obj->dest = obj->me;
4352

4453
obj->Wrap(args.This());
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
67301606083eec702fbbe12c768b56948b419c01
1+
4fda6ee03d3d0a305fe239d968ca4af46f4fda05

source/agent/addons/quic/test/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/agent/analytics/analytics-agent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ class AnalyticsAgent extends BaseAgent {
2525
this.engine = new VideoAnalyzer();
2626

2727
this.flag = 0;
28+
this.ticket = null;
2829
}
2930

3031
// override
3132
createInternalConnection(connectionId, direction, internalOpt) {
3233
internalOpt.minport = global.config.internal.minport;
3334
internalOpt.maxport = global.config.internal.maxport;
35+
this.ticket = internalOpt.ticket;
3436
if (direction == 'in') {
35-
this.engine.emitListenTo(internalOpt.minport,internalOpt.maxport);
37+
this.engine.emitListenTo(internalOpt.minport,internalOpt.maxport, this.ticket);
3638
const portInfo = this.engine.getListeningPort();
3739
// Create internal connection always success
3840
return Promise.resolve({ip: global.config.internal.ip_address, port: portInfo});

0 commit comments

Comments
 (0)