diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts
index decebbf7f3cdc055e1e21d9c7896cb3082768e89..e60bad06c0c4061080016070eab995154feb2acc 100644
--- a/app/modules/ws2p/lib/WS2PCluster.ts
+++ b/app/modules/ws2p/lib/WS2PCluster.ts
@@ -1,3 +1,4 @@
+import { DEFAULT_ENCODING } from 'crypto';
 import {WS2PServer} from "./WS2PServer"
 import {Server} from "../../../../server"
 import {WS2PClient} from "./WS2PClient"
@@ -565,29 +566,32 @@ export class WS2PCluster {
 
   private getApi() {
     let api = 'WS2P'
-    let network = ''
+    let network = {
+      in: WS2PConstants.NETWORK.INCOMING.DEFAULT,
+      out: WS2PConstants.NETWORK.OUTCOMING.DEFAULT,
+    }
     let ws2pPrivate = ''
     let ws2pPublic = ''
     if (this.server.conf.proxiesConf && (this.server.conf.proxiesConf.proxyTorAddress || this.server.conf.proxiesConf.forceTor)) {
-      network = 'TOR'
+      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)) {
-          network = 'TOR'
+          network.in = WS2PConstants.NETWORK.INCOMING.TOR
         }
         if (this.server.conf.ws2p.publicAccess) {
           ws2pPublic = 'I'
-          switch (network) {
-            case 'TOR': ws2pPublic += 'T'; break;
+          switch (network.in) {
+            case WS2PConstants.NETWORK.INCOMING.TOR: ws2pPublic += 'T'; break;
             default: ws2pPublic += 'C'; break;
           }
         }
       }
       if (this.server.conf.ws2p.privateAccess) {
         ws2pPrivate = 'O'
-        switch (network) {
-          case 'TOR': ws2pPrivate += 'T';
+        switch (network.out) {
+          case WS2PConstants.NETWORK.OUTCOMING.TOR: ws2pPrivate += 'T';
             if (this.server.conf.proxiesConf && this.server.conf.proxiesConf.reachingClearEp) {
               switch (this.server.conf.proxiesConf.reachingClearEp) {
                 case 'none': ws2pPrivate += 'S'; break;
diff --git a/app/modules/ws2p/lib/WS2PConnection.ts b/app/modules/ws2p/lib/WS2PConnection.ts
index 72d30aceb47342aa975329879de42ff8e69e1c00..64e85414b833e3dd55cfdd65b2d4b7d0001ccc83 100644
--- a/app/modules/ws2p/lib/WS2PConnection.ts
+++ b/app/modules/ws2p/lib/WS2PConnection.ts
@@ -341,7 +341,7 @@ export class WS2PConnection {
     const onWsClosed:Promise<void> = new Promise(res => {
       websocket.on('close', () => res())
     })
-    return new WS2PConnection(WS2PConstants.WS2P_DEFAULT_VERSION, websocket, onWsOpened, onWsClosed, messageHandler, localAuth, remoteAuth, options, expectedPub)
+    return new WS2PConnection(WS2PConstants.WS2P_DEFAULT_API_VERSION, websocket, onWsOpened, onWsClosed, messageHandler, localAuth, remoteAuth, options, expectedPub)
   }
 
   get version() {
diff --git a/app/modules/ws2p/lib/constants.ts b/app/modules/ws2p/lib/constants.ts
index 74d5c586aae320f99315794f9d0ad295aa82dfc6..0a281b5699fa195a1109f1d47ff959cdb6b3e4bf 100644
--- a/app/modules/ws2p/lib/constants.ts
+++ b/app/modules/ws2p/lib/constants.ts
@@ -1,7 +1,19 @@
 import {CommonConstants} from "../../../lib/common-libs/constants"
 export const WS2PConstants = {
 
-  WS2P_DEFAULT_VERSION:1,
+  NETWORK: {
+    INCOMING: {
+      DEFAULT: 0,
+      TOR: 1
+    },
+    OUTCOMING: {
+      DEFAULT: 0,
+      TOR: 1
+    },
+  },
+
+  WS2P_DEFAULT_API_VERSION:1,
+  WS2P_DEFAULT_HEAD_VERSION:1,
   WS2P_API_VERSION: 1,
   WS2P_HEAD_VERSION: 2,