diff --git a/client.js b/client.js index ee9d620..aa6d1c1 100644 --- a/client.js +++ b/client.js @@ -35,7 +35,7 @@ function initClient(options) { // Current style using sub-domain: https://{{clientId}}-tunnel.myhostingdomain.com // (Original server: https://tunnel.myhostingdomain.com) const profile = options.profile || PROFILE_DEFAULT; - const clientId = `${options.clientId || options.apiKey || generateUUID()}`; + const clientId = `${options.apiKey || options.clientId || generateUUID()}`; const clientIdSub = profile === PROFILE_DEFAULT ? `${clientId}-` : `${clientId}-${profile}-`; const clientEndpoint = ( @@ -45,6 +45,7 @@ function initClient(options) { .trim(); const serverUrl = addPrefixOnHttpSchema(options.server, clientEndpoint); + // extra options for socket to identify the client (authentication and options of tunnel) const defaultParams = { apiKey: options.apiKey, clientId: options.clientId, @@ -56,6 +57,15 @@ function initClient(options) { keep_connection: options.keep_connection || true, }; + // extra info for notify about the running of the tunnel (it's private info, other platfom cannot access this) + // this using for internal only (don't worry about this) + const osInfo = { + hostname: os.hostname(), + platform: os.platform(), + arch: os.arch(), + release: os.release(), + }; + const initParams = { path: "/$cubetiq_http_tunnel", transports: ["websocket"], @@ -65,6 +75,7 @@ function initClient(options) { }, headers: { ...defaultParams, + os: osInfo, }, }; diff --git a/package.json b/package.json index 07bb905..df93a5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cubetiq/hlt", - "version": "0.0.7", + "version": "0.0.8", "description": "A lightweight http tunnel client using nodejs and socket.io client", "main": "client.js", "bin": {