Close

Diving into Synology QuickConnect and creating a JavaScript library

Two years back I created a Chrome extension that would allow me to quickly monitor my Synology NAS CPU usage and memory since I was having strange CPU usage spikes.
But after I fixed the problem on my NAS I stopped updating the extension itself and off course things tend to change in that amount of time. Last week I decided I would dive into it again and add support for Synology QuickConnect!

What is QuickConnect?

So what is QuickConnect? In simple terms it means you simply go to one static URL which is formed like “[unique_id].quickconnect.to” and it will redirect you to the IP-address of your NAS or tunnel you through the Synology servers without having to open any ports on your router. Synology uses this option in all of its apps because it really adds to the usability and speeds up logging in. So I figured, why not add that to my extension!

Well…. that is easier said than done, there is not really any public API that is accessible and certainly no documentation. But luckily there is always your browsers developer tools to see what is going on under the hood!

And so the search begins

So I opened Chrome, went to my own QuickConnect URL (which I will not be posting here for obvious reasons) and looked at my developer tools and found the following:

The Google Chrome network console
The Google Chrome network console

The first call that happens is to Serv.php which basically accepts a QuickConnect ID and spews back all the possible addresses it can think of where the NAS for that account is located. An example of the JSON can be found below (All important fields are marked, for security reasons the IP address has also been removed):

 
[  
   {  
      "server":{  
         "external":{  
            "ip":"[IP5 ADDRESS]",
            "ipv6":"[IP6 ADDRESS]"
         },
         "version":"15132",
         "ipv6_tunnel":[  

         ],
         "serverID":"00550318",
         "ddns":"NULL",
         "fqdn":"NULL",
         "udp_punch_port":59854,
         "interface":[  
            {  
               "mask":"255.255.255.0",
               "name":"eth0",
               "ip":"[LOCAL IP5 ADDRESS]",
               "ipv6":[  
                  {  
                     "address":"[LOCAL IP6 ADDRESS]",
                     "scope":"global",
                     "prefix_length":64,
                     "addr_type":0
                  },
                  {  
                     "address":"[LOCAL IP6 ADDRESS]",
                     "scope":"link",
                     "prefix_length":64,
                     "addr_type":32
                  }
               ]
            }
         ],
         "gateway":"192.168.0.1",
         "tcp_punch_port":0,
         "ds_state":"CONNECTED"
      },
      "command":"get_server_info",
      "version":1,
      "service":{  
         "ext_port":[HTTPS PORT],
         "pingpong_desc":[  

         ],
         "pingpong":"DISCONNECTED",
         "port":[HTTPS PORT]
      },
      "errno":0,
      "env":{  
         "control_host":"ukc.quickconnect.to",
         "relay_region":"uk"
      }
   },
   {  
      "errno":4,
      "command":"get_server_info",
      "version":1,
      "errinfo":"GetServInfo.lua:103"
   }
]

So basically with this service you have all you need to connect to a NAS server, but as I mentioned earlier this service spews out all “POSSIBLE” locations, so it doesn’t mean that they all work.

Putting it all together

All that is left for you to do, is just sending out a simple ping and see if you get a pong back! I can go more into detail on how this all works, but all my source files are available on what I have done with this:

A JS library:https://github.com/taurgis/js-quickconnectid
A NPM package: https://github.com/taurgis/npm-quickconnectid 

And this JavaScript library is used in the Chrome plugin which can be found here: https://github.com/taurgis/SynologyStatus.

I hope this post helped answer some questions you were looking for!

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email

Leave a Reply

Your email address will not be published. Required fields are marked *