From 680c91aff531fca6fa2394094252520adac5f9e3 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 3 May 2023 10:41:54 +0200 Subject: Client + Types: Expose support contact --- client/client.go | 12 ++++++++---- types/server/server.go | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/client.go b/client/client.go index 28a310b..e79f708 100644 --- a/client/client.go +++ b/client/client.go @@ -676,6 +676,7 @@ func (c *Client) pubCurrentServer(srv server.Server) (*srvtypes.Current, error) return &srvtypes.Current{ Institute: &srvtypes.Institute{ Server: *t, + SupportContacts: b.SupportContact, // TODO: delisted Delisted: false, }, @@ -687,6 +688,7 @@ func (c *Client) pubCurrentServer(srv server.Server) (*srvtypes.Current, error) Type: srvtypes.TypeCustom, }, nil case *srvtypes.SecureInternet: + t.SupportContacts = b.SupportContact t.Locations = c.Discovery.SecureLocationList() return &srvtypes.Current{ SecureInternet: t, @@ -703,21 +705,23 @@ func (c *Client) pubServer(srv server.Server) (interface{}, error) { if err != nil { return nil, err } + b, err := srv.Base() + if err != nil { + return nil, err + } switch t := pub.(type) { case *srvtypes.Server: - b, err := srv.Base() - if err != nil { - return nil, err - } if b.Type == srvtypes.TypeInstituteAccess { return &srvtypes.Institute{ Server: *t, + SupportContacts: b.SupportContact, // TODO: delisted Delisted: false, }, nil } return t, nil case *srvtypes.SecureInternet: + t.SupportContacts = b.SupportContact t.Locations = c.Discovery.SecureLocationList() return t, nil default: diff --git a/types/server/server.go b/types/server/server.go index 3bdebe1..4198e86 100644 --- a/types/server/server.go +++ b/types/server/server.go @@ -125,6 +125,8 @@ type Server struct { type Institute struct { // Server is the embedded server struct Server + // SupportContacts are the list of support contacts + SupportContacts []string `json:"support_contacts"` // Delisted is a boolean that indicates whether or not this server is delisted from discovery // If it is, the UI should show a warning symbol or move the server to a new category, which is up to the client Delisted bool `json:"delisted"` @@ -138,6 +140,8 @@ type SecureInternet struct { CountryCode string `json:"country_code"` // Locations is the list of available secure internet locations Locations []string `json:"locations"` + // SupportContacts are the list of support contacts + SupportContacts []string `json:"support_contacts"` // Delisted is a boolean that indicates whether or not this server is delisted from discovery // If it is, the UI should show a warning symbol or move the server to a new category, which is up to the client Delisted bool `json:"delisted"` -- cgit v1.2.3