diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts index 3502138a3b4655bc2218819b86e4809922d87f81..101e0c89dc13fea9e2f225f92b5388c3504bc445 100644 --- a/app/modules/ws2p/lib/WS2PCluster.ts +++ b/app/modules/ws2p/lib/WS2PCluster.ts @@ -587,24 +587,31 @@ export class WS2PCluster { } let ws2pPrivate = '' let ws2pPublic = '' - if (this.server.conf.proxiesConf && (this.server.conf.proxiesConf.proxyTorAddress || this.server.conf.proxiesConf.forceTor)) { - network.out = WS2PConstants.NETWORK.OUTCOMING.TOR - } if (this.server.conf.ws2p) { - if (this.server.conf.ws2p.remotehost) { - if (this.server.conf.ws2p.remotehost.match(WS2PConstants.HOST_ONION_REGEX)) { + if (this.server.conf.ws2p.publicAccess && + (this.server.conf.ws2p.remotehost && this.server.conf.ws2p.remoteport) + || + (this.server.conf.ws2p.upnp && this.server.conf.upnp) + ) + { + ws2pPublic = 'I' + // Determine the network layer + if (this.server.conf.ws2p.remotehost && this.server.conf.ws2p.remotehost.match(WS2PConstants.HOST_ONION_REGEX)) { network.in = WS2PConstants.NETWORK.INCOMING.TOR } - if (this.server.conf.ws2p.publicAccess) { - ws2pPublic = 'I' - switch (network.in) { - case WS2PConstants.NETWORK.INCOMING.TOR: ws2pPublic += 'T'; break; - default: ws2pPublic += 'C'; break; - } + // Apply the network layer + switch (network.in) { + case WS2PConstants.NETWORK.INCOMING.TOR: ws2pPublic += 'T'; break; + default: ws2pPublic += 'C'; break; } } if (this.server.conf.ws2p.privateAccess) { ws2pPrivate = 'O' + // Determine the network layer + if (this.server.conf.proxiesConf && (this.server.conf.proxiesConf.proxyTorAddress || this.server.conf.proxiesConf.forceTor)) { + network.out = WS2PConstants.NETWORK.OUTCOMING.TOR + } + // Apply the network layer switch (network.out) { case WS2PConstants.NETWORK.OUTCOMING.TOR: ws2pPrivate += 'T'; if (this.server.conf.proxiesConf && this.server.conf.proxiesConf.reachingClearEp) { @@ -615,7 +622,7 @@ export class WS2PCluster { } } break; - default: ws2pPrivate += 'C'; break; + default: ws2pPrivate += 'CA'; break; } } } diff --git a/app/modules/ws2p/lib/constants.ts b/app/modules/ws2p/lib/constants.ts index b57598b7bbe327066124970f0469d33a9df9f9c6..84bda573fd1f43d4a19ba45bb1ff8735ef9997e5 100644 --- a/app/modules/ws2p/lib/constants.ts +++ b/app/modules/ws2p/lib/constants.ts @@ -52,7 +52,7 @@ export const WS2PConstants = { + CommonConstants.FORMATS.BLOCKSTAMP + '$'), - HEAD_V1_REGEXP: new RegExp('^WS2P(?:O[CT][SAM])?(?:I[CT])?:HEAD:1:' + HEAD_V1_REGEXP: new RegExp('^WS2P(?:O[CT][SAM]?)?(?:I[CT])?:HEAD:1:' + '(' + CommonConstants.FORMATS.PUBKEY + '):' + '(' + CommonConstants.FORMATS.BLOCKSTAMP + '):' + '(' + CommonConstants.FORMATS.WS2PID + '):' @@ -61,7 +61,7 @@ export const WS2PConstants = { + '(' + CommonConstants.FORMATS.POW_PREFIX + ')' + '$'), - HEAD_V2_REGEXP: new RegExp('^WS2P(?:O[CT][SAM])?(?:I[CT])?:HEAD:2:' + HEAD_V2_REGEXP: new RegExp('^WS2P(?:O[CT][SAM]?)?(?:I[CT])?:HEAD:2:' + '(' + CommonConstants.FORMATS.PUBKEY + '):' + '(' + CommonConstants.FORMATS.BLOCKSTAMP + '):' + '(' + CommonConstants.FORMATS.WS2PID + '):'