Documentation ¶
Overview ¶
Package qcon implements the QuickConnect protocol for accessing Synology NAS devices over the best available connection using a globally unique identifier. The returned URLs will vary depending on the client network relative to the Synology - for example, if on the same LAN local URLs will be returned, otherwise URLs using remote address (or even a Synology created tunnel) will be returned.
For most cases, all that is necessary is to pass the QuickConnect ID to the Resolve() function which will return a prioritized list of URLs:
// Create context ctx := context.Background() // Fetch list of URLs urls, err := qcon.Resolve(ctx, id) // Provided no error returned, the first URL in the returned slice // will be the most desired available connection. This can then // be used to access the Synology API
More control can be obtained by creating a Client with custom settings (including modifying the default http.Client).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTimeout error = errors.New("operation timed out") ErrCancelled error = errors.New("operation cancelled") ErrInvalidID error = errors.New("invalid server ID") ErrCannotAccess error = errors.New("cannot access any URLs") ErrParse error = errors.New("response parse error") ErrPingFailure error = errors.New("ping response failure") ErrUnknownCommand error = errors.New("unknown command") ErrUnknownServerType error = errors.New("unknown server type") )
var DefaultClient = &Client{}
DefaultClient is the default Client used by Resolve.
Functions ¶
Types ¶
type Client ¶
type Client struct { Client *http.Client Timeout time.Duration // contains filtered or unexported fields }
Client provides HTTP(S) connectivity to the central QuickConnect server and is also used for testing connectivity to returned URLs.
Client allows setting of non-default timeout and http.Client options for increased control over method behavior. Timeout is separate from any timeout settings inherited from http.Client and refers to the time Resolve() and UpdateState() will wait for responses during connectivity tests.
func (Client) GetInfo ¶
GetInfo returns information for given QuickConnect ID retrieved from the global QuickConnect server. This information includes the set of all Records associated with this ID (see struct Info).
func (Client) Ping ¶
Ping attempts a ping-pong request to the given URL and returns an MD5 hash of the ServerID from the response for use in verification.