psinet.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2016, Psiphon Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. package server
  20. // PsinetDatabase serves Psiphon API data requests. It's safe for
  21. // concurrent usage.
  22. type PsinetDatabase struct {
  23. }
  24. // NewPsinetDatabase initializes a PsinetDatabase. It loads the specified
  25. // file, which should be in the Psiphon automation jsonpickle format, and
  26. // prepares to serve data requests.
  27. // The input "" is valid and returns a functional PsinetDatabase with no
  28. // data.
  29. func NewPsinetDatabase(filename string) (*PsinetDatabase, error) {
  30. // TODO: implement
  31. return &PsinetDatabase{}, nil
  32. }
  33. // GetHomepages returns a list of home pages for the specified sponsor,
  34. // region, and platform.
  35. func (psinet *PsinetDatabase) GetHomepages(sponsorID, clientRegion, clientPlatform string) []string {
  36. // TODO: implement
  37. return make([]string, 0)
  38. }
  39. // GetUpgradeClientVersion returns a new client version when an upgrade is
  40. // indicated for the specified client current version. The result is "" when
  41. // no upgrade is available.
  42. func (psinet *PsinetDatabase) GetUpgradeClientVersion(clientVersion, clientPlatform string) string {
  43. // TODO: implement
  44. return ""
  45. }
  46. // GetHttpsRequestRegexes returns bytes transferred stats regexes for the
  47. // specified sponsor.
  48. func (psinet *PsinetDatabase) GetHttpsRequestRegexes(sponsorID string) []map[string]string {
  49. return make([]map[string]string, 0)
  50. }
  51. // DiscoverServers selects new encoded server entries to be "discovered" by
  52. // the client, using the discoveryValue as the input into the discovery algorithm.
  53. func (psinet *PsinetDatabase) DiscoverServers(propagationChannelID string, discoveryValue int) []string {
  54. // TODO: implement
  55. return make([]string, 0)
  56. }