Skip to content

Commit

Permalink
Merge pull request #381 from MatrixAI/feature-nat-testing
Browse files Browse the repository at this point in the history
Tests for NAT-Traversal and Hole-Punching
  • Loading branch information
emmacasolin authored Jun 24, 2022
2 parents 89beb41 + 7c91ace commit d60ab44
Show file tree
Hide file tree
Showing 90 changed files with 2,799 additions and 126 deletions.
47 changes: 24 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
},
"dependencies": {
"@grpc/grpc-js": "1.6.7",
"@matrixai/async-init": "^1.7.3",
"@matrixai/async-locks": "^2.2.5",
"@matrixai/async-init": "^1.8.1",
"@matrixai/async-locks": "^2.3.1",
"@matrixai/db": "^4.0.5",
"@matrixai/errors": "^1.1.1",
"@matrixai/id": "^3.3.3",
"@matrixai/logger": "^2.1.1",
"@matrixai/logger": "^2.2.2",
"@matrixai/resources": "^1.1.3",
"@matrixai/workers": "^1.3.3",
"ajv": "^7.0.4",
Expand Down Expand Up @@ -138,6 +138,7 @@
"node-gyp-build": "^4.4.0",
"pkg": "5.6.0",
"prettier": "^2.6.2",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-jest": "^27.0.5",
"ts-node": "10.7.0",
Expand Down
8 changes: 6 additions & 2 deletions src/PolykeyAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ class PolykeyAgent {
acl: this.acl,
gestaltGraph: this.gestaltGraph,
proxy: this.proxy,
logger: this.logger.getChild(createAgentService.name),
logger: this.logger.getChild('GRPCClientAgentService'),
});
const clientService = createClientService({
pkAgent: this,
Expand All @@ -627,7 +627,7 @@ class PolykeyAgent {
grpcServerAgent: this.grpcServerAgent,
proxy: this.proxy,
fs: this.fs,
logger: this.logger.getChild(createClientService.name),
logger: this.logger.getChild('GRPCClientClientService'),
});
// Starting modules
await this.keyManager.start({
Expand Down Expand Up @@ -696,6 +696,10 @@ class PolykeyAgent {
await this.notificationsManager?.stop();
await this.vaultManager?.stop();
await this.discovery?.stop();
await this.queue?.stop();
await this.nodeGraph?.stop();
await this.nodeConnectionManager?.stop();
await this.nodeManager?.stop();
await this.proxy?.stop();
await this.grpcServerAgent?.stop();
await this.grpcServerClient?.stop();
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import * as agentUtils from '../utils';
function createService({
proxy,
db,
logger = new Logger(createService.name),
logger = new Logger('GRPCClientAgentService'),
...containerRest
}: {
db: DB;
Expand Down
3 changes: 2 additions & 1 deletion src/agent/service/nodesChainDataGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function nodesChainDataGet({
return;
} catch (e) {
callback(grpcUtils.fromError(e, true));
!agentUtils.isAgentClientError(e) && logger.error(e);
!agentUtils.isAgentClientError(e) &&
logger.error(`${nodesChainDataGet.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/agent/service/nodesClosestLocalNodesGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function nodesClosestLocalNodesGet({
return;
} catch (e) {
callback(grpcUtils.fromError(e, true));
!agentUtils.isAgentClientError(e) && logger.error(e);
!agentUtils.isAgentClientError(e) &&
logger.error(`${nodesClosestLocalNodesGet.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/nodesCrossSignClaim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function nodesCrossSignClaim({
claimsErrors.ErrorUndefinedSignature,
claimsErrors.ErrorNodesClaimType,
claimsErrors.ErrorUndefinedDoublySignedClaim,
]) && logger.error(e);
]) && logger.error(`${nodesCrossSignClaim.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/agent/service/nodesHolePunchMessageSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function nodesHolePunchMessageSend({
return;
} catch (e) {
callback(grpcUtils.fromError(e, true));
!agentUtils.isAgentClientError(e) && logger.error(e);
!agentUtils.isAgentClientError(e) &&
logger.error(`${nodesHolePunchMessageSend.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/notificationsSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function notificationsSend({
notificationsErrors.ErrorNotificationsValidationFailed,
notificationsErrors.ErrorNotificationsParse,
notificationsErrors.ErrorNotificationsPermissionsNotFound,
]) && logger.error(e);
]) && logger.error(`${notificationsSend.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/vaultsGitInfoGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function vaultsGitInfoGet({
vaultsErrors.ErrorVaultsVaultUndefined,
agentErrors.ErrorConnectionInfoMissing,
vaultsErrors.ErrorVaultsPermissionDenied,
]) && logger.error(e);
]) && logger.error(`${vaultsGitInfoGet.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/vaultsGitPackGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function vaultsGitPackGet({
agentErrors.ErrorConnectionInfoMissing,
vaultsErrors.ErrorVaultsPermissionDenied,
vaultsErrors.ErrorVaultsVaultUndefined,
]) && logger.error(e);
]) && logger.error(`${vaultsGitPackGet.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/agent/service/vaultsScan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function vaultsScan({
!agentUtils.isAgentClientError(e, [
agentErrors.ErrorConnectionInfoMissing,
vaultsErrors.ErrorVaultsPermissionDenied,
]) && logger.error(e);
]) && logger.error(`${vaultsScan.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/GRPCClientClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ class GRPCClientClient extends GRPCClient<ClientServiceClient> {
nodeId: this.nodeId,
host: this.host,
port: this.port,
command: this.identitiesAuthenticate.name,
command: this.nodesGetAll.name,
},
this.client.nodesGetAll,
)(...args);
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/agentLockAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function agentLockAll({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${agentLockAll.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/agentStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ function agentStatus({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${agentStatus.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/agentStop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function agentStop({
callback(null, response);
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${agentStop.name}:${e}`);
return;
}
// Stop is called after GRPC resources are cleared
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/agentUnlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function agentUnlock({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${agentUnlock.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsActionsGetByIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function gestaltsActionsGetByIdentity({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsActionsGetByIdentity.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsActionsGetByNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ function gestaltsActionsGetByNode({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsActionsGetByNode.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/service/gestaltsActionsSetByIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function gestaltsActionsSetByIdentity({
!clientUtils.isClientClientError(e, [
gestaltsErrors.ErrorGestaltsGraphIdentityIdMissing,
gestaltsErrors.ErrorGestaltsGraphNodeIdMissing,
]) && logger.error(e);
]) && logger.error(`${gestaltsActionsSetByIdentity.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/service/gestaltsActionsSetByNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function gestaltsActionsSetByNode({
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e, [
gestaltsErrors.ErrorGestaltsGraphNodeIdMissing,
]) && logger.error(e);
]) && logger.error(`${gestaltsActionsSetByNode.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/service/gestaltsActionsUnsetByIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function gestaltsActionsUnsetByIdentity({
!clientUtils.isClientClientError(e, [
gestaltsErrors.ErrorGestaltsGraphIdentityIdMissing,
gestaltsErrors.ErrorGestaltsGraphNodeIdMissing,
]) && logger.error(e);
]) && logger.error(`${gestaltsActionsUnsetByIdentity.name}:${e}`);
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/client/service/gestaltsActionsUnsetByNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function gestaltsActionsUnsetByNode({
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e, [
gestaltsErrors.ErrorGestaltsGraphNodeIdMissing,
]) && logger.error(e);
]) && logger.error(`${gestaltsActionsUnsetByNode.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsDiscoveryByIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function gestaltsDiscoveryByIdentity({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsDiscoveryByIdentity.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsDiscoveryByNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ function gestaltsDiscoveryByNode({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsDiscoveryByNode.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsGestaltGetByIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function gestaltsGestaltGetByIdentity({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsGestaltGetByIdentity.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsGestaltGetByNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function gestaltsGestaltGetByNode({
return;
} catch (e) {
callback(grpcUtils.fromError(e));
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsGestaltGetByNode.name}:${e}`);
return;
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/service/gestaltsGestaltList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function gestaltsGestaltList({
return;
} catch (e) {
await genWritable.throw(e);
!clientUtils.isClientClientError(e) && logger.error(e);
!clientUtils.isClientClientError(e) &&
logger.error(`${gestaltsGestaltList.name}:${e}`);
return;
}
};
Expand Down
Loading

0 comments on commit d60ab44

Please sign in to comment.