discovery

package
v0.0.0-...-f308040 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package discovery defines the public types that have to deal with discovery

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapOrString

type MapOrString map[string]string

MapOrString is a custom type as the upstream discovery format is a map or a value. This library always marshals the data as a map and then makes sure unmarshalling also gives a map

func (*MapOrString) UnmarshalJSON

func (displayName *MapOrString) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the display name. It can either be a map or a string in the server list Unmarshal it by first trying a string and then the map.

type Organization

type Organization struct {
	// DisplayName is the map of strings from language tags to display names
	// Omitted if none is defined
	DisplayName MapOrString `json:"display_name,omitempty"`
	// OrgID is the organization ID for the server
	OrgID string `json:"org_id"`
	// score is the score internally used for sorting
	Score int `json:"-"`
}

Organization is the type that defines the upstream discovery format for a single organization

type Organizations

type Organizations struct {
	// List is the list/slice of organizations. Omitted if none are there
	List []Organization `json:"organization_list,omitempty"`
}

Organizations is the type that defines the upstream discovery format for the list of organizations It is a subset of the format from URL: "https://disco.eduvpn.org/v2/organization_list.json"

type Server

type Server struct {
	// BaseURL is the base URL of the server which is used as an identifier for the server by the Go library
	BaseURL string `json:"base_url"`
	// DisplayName is the display name of the server, omitted if empty
	DisplayName MapOrString `json:"display_name,omitempty"`
	// Type is the type of the server, "secure_internet" or "institute_access"
	Type string `json:"server_type"`
	// CountryCode is the country code of the server if Type is "secure_internet", e.g. nl
	CountryCode string `json:"country_code"`
	// score is the score internally used for sorting
	Score int `json:"-"`
}

Server is a signle discovery server

type Servers

type Servers struct {
	// List is the actual list of servers, omitted from the JSON if empty
	List []Server `json:"server_list,omitempty"`
}

Servers is the type that defines the upstream discovery format for the list of servers url: "https://disco.eduvpn.org/v2/server_list.json"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL