alexiscn / SynologyKit

Synology File Station SDK for Swift
MIT License
37 stars 8 forks source link

Does Quickconnect work? #13

Closed gameo1 closed 4 years ago

gameo1 commented 4 years ago

Hi, I have success in login in and listing content using the IP address, but not with the QuickConnect. Is there anything particular to do?

alexiscn commented 4 years ago

Yes, it works. You can login via Quick Connect within example.

Can you login with your quickconnectid in https://`quickconnectid`.quickconnect.to ?

gameo1 commented 4 years ago

yes I can, as well as from the apps in iOS. Using qc, the app doesnt reply anything, neither success or failure while using qc. Instead, works perfectly with an IP @ on the same LAN

gameo1 commented 4 years ago

hi again, this is what I do according to the example:

    var enableHTTPS = false

    func doLogin() {

        if address.contains(".") {
            print("we are using LAN\n")
            let port = enableHTTPS ? 5001: 5000
            client = SynologyClient(host: address, port: port, enableHTTPS: enableHTTPS)
        } else {
            print("we are using WAN\n")
             client = SynologyClient(host: address)
        }
        print("trying to login\n")
        client?.login(account: account, passwd: password) { [weak self] response in ...

While in WAN, it stays stuck here. In LAN, I got quite imediate success login.

I wonder what I am doing wrong. Thanks for helping

alexiscn commented 4 years ago

Does your address contains . ? Can you ping https://cnc.quickconnect.to

You can debug into SynologyKit. Related code in SynologyClient.swift line 765

gameo1 commented 4 years ago

in case of quickconnect, i enter only the name of the nas, so no "." in the DSAudio app on iOS, I can log with the name of my NAS: "myPersonalNAS" so, in the code, I use the String "myPersonalNAS" as well, thus calling client = SynologyClient(host: address) with address being filled with "myPersonalNAS"

https://cnc.quickconnect.to is pingable yes.

alexiscn commented 4 years ago

Since NAS is private staff. I think you'd better debug yourself. The entrance of login function is

public func login(account: String, passwd: String, completion: @escaping SynologyCompletion<AuthResponse>)

Can you print response in getServerInfo(quickID: host) { response in

Maybe getServerInfo(quickID: host) is successful but can not get replayIP or relayPort

gameo1 commented 4 years ago

I did debug the login function: in fact, is no "." is used in host so it calls the getServerInfo(quickID....) from this call, i have a success, but service is nil: login success using QuickID with QuickIDResponse(command: "request_tunnel", version: 1, errno: 4, service: nil) any idea what it can be?

alexiscn commented 4 years ago

It seems error is

104: "The requested version does not support the functionality"

Do you enable Quick Connect in Control Panel. And What's your Synology NAS Version?

gameo1 commented 4 years ago

yes, if I can login with AudioDS on iphone with the quickconnectID as well as using https://quickconnectid.quickconnect.to

Version is 6.2...

EDIT: working with local IP, WAN IP but not with the QuickID. Still getting the service nil in the QuickIDResponse. On the NAS, QuickID is enabled. Can't figure out why not. more, I don't know how to debug it.

gameo1 commented 4 years ago

do you have an example of quickconnect working? i believe ccn.quickconnect will not work for me. i might use global.quickconnect instead. Is the Agent description important? it is hard to debug because everything is async. I am struggling.

alexiscn commented 4 years ago

Fixed, try it again. :D

gameo1 commented 4 years ago

Hi Alexis I cant have your app working: signin with QuickID always responds with "unknow Error" Therefore, to test, in the viewdidload, after make the getGlobalServerInfo method public, I use the following code: client = SynologyClient(host: "myNAS") client?.getGlobalServerInfo(quickID: "myNAS") { response in switch response { case .success(let data): print(data) case .failure(let error): print(error.description) } }

and I get a positive answer from the ddns service. So thanks a lot. As i try to modify your code to have it working, just for curiosity, I would be happy to know what and how you fixed it. Thanks in any case, because of the work and the responsiveness

alexiscn commented 4 years ago

I can sign in my NAS with QuickID in the demo, I do not know what's wrong. I will find how DS file and DS audio do with QuickID

alexiscn commented 4 years ago

I have added some addition code to make it work. Please retry...

gameo1 commented 4 years ago

working, perfect. Thanks a lot!

gameo1 commented 4 years ago

last question, how are the credentials sent over the network? in clear? Thanks

alexiscn commented 4 years ago

You can use charles to catch the network traffic. Actually DS audio send plaintext to the server.... so does SynologyKit