summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/src/api/functiondocs.md36
-rw-r--r--exports/exports.go11
2 files changed, 29 insertions, 18 deletions
diff --git a/docs/src/api/functiondocs.md b/docs/src/api/functiondocs.md
index 480c10a..db5f470 100644
--- a/docs/src/api/functiondocs.md
+++ b/docs/src/api/functiondocs.md
@@ -295,8 +295,10 @@ DiscoOrganizations gets the organizations from discovery, returned as
types/discovery/discovery.go Organizations marshalled as JSON
`c` is the Cookie that needs to be passed. Create a new Cookie using
-`CookieNew` `search` is the search string for filtering the list. It checks
-for keywords and display name case insensitive as a substring matching.
+`CookieNew` `search` is the search string for filtering the list. If any of
+the words in the search query is not contained in any of the display names
+or keywords, the candidate is filtered. Otherwise they are ranked based on
+the levenshtein distance: https://en.wikipedia.org/wiki/Levenshtein_distance
If search is empty it returns ALL organizations currently known in common
If it was unsuccessful, it returns an error. Note that when the lib was
@@ -354,10 +356,10 @@ DiscoServers gets the servers from discovery, returned as
types/discovery/discovery.go Servers marshalled as JSON
`c` is the Cookie that needs to be passed. Create a new Cookie using
-`CookieNew` `search` is the search string for filtering the list. It checks
-for keywords and display name case insensitive as a substring matching.
-If search is empty it returns ALL servers currently known in common,
-including secure internet servers that do not have a display name set
+`CookieNew` `search` is the search string for filtering the list. If any of
+the words in the search query is not contained in any of the display names
+or keywords, the candidate is filtered. Otherwise they are ranked based on
+the levenshtein distance: https://en.wikipedia.org/wiki/Levenshtein_distance
If it was unsuccessful, it returns an error. Note that when the lib was
built in release mode the data is almost always non-nil, even when an error
@@ -367,16 +369,18 @@ Example Input: ```DiscoServers(myCookie, "")```
Example Output:
- {
- "server_list": [
- {
- "base_url": "https://eduvpn.rash.al/",
- "server_type": "secure_internet",
- },
- {
- "base_url": "https://eduvpn.deic.dk/",
- "server_type": "secure_internet",
- } , null
+ {
+ "server_list": [
+ {
+ "base_url": "https://eduvpn.rash.al/",
+ "country_code": "AL",
+ "server_type": "secure_internet",
+ },
+ {
+ "base_url": "https://eduvpn.deic.dk/",
+ "country_code": "DK",
+ "server_type": "secure_internet",
+ } , null
Example Input: ```DiscoServers(myCookie, "heanet")```
diff --git a/exports/exports.go b/exports/exports.go
index c169260..008ac67 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -671,7 +671,9 @@ func SetSecureLocation(orgID *C.char, cc *C.char) *C.char {
// DiscoServers gets the servers from discovery, returned as types/discovery/discovery.go Servers marshalled as JSON
//
// `c` is the Cookie that needs to be passed. Create a new Cookie using `CookieNew`
-// `search` is the search string for filtering the list. It checks for keywords and display name case insensitive as a substring matching. If search is empty it returns ALL servers currently known in common, including secure internet servers that do not have a display name set
+// `search` is the search string for filtering the list.
+// If any of the words in the search query is not contained in any of the display names or keywords, the candidate is filtered.
+// Otherwise they are ranked based on the levenshtein distance: https://en.wikipedia.org/wiki/Levenshtein_distance
//
// If it was unsuccessful, it returns an error. Note that when the lib was built in release mode the data is almost always non-nil, even when an error has occurred
// This means it has just returned the cached list
@@ -684,10 +686,12 @@ func SetSecureLocation(orgID *C.char, cc *C.char) *C.char {
// "server_list": [
// {
// "base_url": "https://eduvpn.rash.al/",
+// "country_code": "AL",
// "server_type": "secure_internet",
// },
// {
// "base_url": "https://eduvpn.deic.dk/",
+// "country_code": "DK",
// "server_type": "secure_internet",
// } , null
//
@@ -731,7 +735,10 @@ func DiscoServers(c C.uintptr_t, search *C.char) (*C.char, *C.char) {
// DiscoOrganizations gets the organizations from discovery, returned as types/discovery/discovery.go Organizations marshalled as JSON
//
// `c` is the Cookie that needs to be passed. Create a new Cookie using `CookieNew`
-// `search` is the search string for filtering the list. It checks for keywords and display name case insensitive as a substring matching. If search is empty it returns ALL organizations currently known in common
+// `search` is the search string for filtering the list.
+// If any of the words in the search query is not contained in any of the display names or keywords, the candidate is filtered.
+// Otherwise they are ranked based on the levenshtein distance: https://en.wikipedia.org/wiki/Levenshtein_distance
+// If search is empty it returns ALL organizations currently known in common
//
// If it was unsuccessful, it returns an error. Note that when the lib was built in release mode the data is almost always non-nil, even when an error has occurred
// This means it has just returned the cached list