Documentation ¶
Overview ¶
Copyright © 2021 Koen Kumps
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func DestinationExists(path string) bool
- func DownloadGitHubIP(metaData **GitHub) (err error)
- func DownloadZoneFiles(countryZones []string) (err error)
- func ExclName() (exclName string)
- func FileExists(file string) (fi fs.FileInfo, err error)
- func InclName() (inclName string)
- func IsTerminal() bool
- func MakeCountryUnblockArray(continents *Continents) (unblockedZones []string)
- func MakeCountryZoneArray(continents *Continents) (countryZones []string)
- func MakeDestination(path string)
- func RootDir() (dir string)
- func UnmarshallAllowedZones(allowedZones **Allowedzones) (err error)
- func UnmarshallBlockedZones(blockedZones **Blockedzones) (err error)
- func UnmarshallCountries(continents **Continents) (err error)
- type Allowedzones
- type Blockedzones
- type Continents
- type GH_ssh_fp
- type GitHub
- type Zones
Constants ¶
This section is empty.
Variables ¶
Debug writes logs in the color cyan with "DEBUG: " as prefix
Error writes logs in the color red with "ERROR: " as prefix
Info writes logs in the color blue with "INFO: " as prefix
Warning writes logs in the color yellow with "WARNING: " as prefix
Functions ¶
func DestinationExists ¶
DestinationExists checks if a path or file exists
func DownloadGitHubIP ¶
DownloadGithubIP fetches the CIDR zones from the GitHub API, meta endpoint
func DownloadZoneFiles ¶
DownloadZoneFiles fetches the CIDR zones files from ipverse.net
It uses concurrent connections to speed up the download
func ExclName ¶
func ExclName() (exclName string)
exclName is a shorthand to get the exclusions file name
func FileExists ¶
FileExists checks if a file exists and returns fileinfo
func InclName ¶
func InclName() (inclName string)
inclName is a shorthand to get the inclusions file name
func MakeCountryUnblockArray ¶
func MakeCountryUnblockArray(continents *Continents) (unblockedZones []string)
MakeCountryUnblockArray condenses all the "Unblocked" from the Continents struct into a single array for easy iteration
func MakeCountryZoneArray ¶
func MakeCountryZoneArray(continents *Continents) (countryZones []string)
MakeCountryZoneArray condenses all the "Zones" from the Continents struct into a single array for easy iteration
func MakeDestination ¶
func MakeDestination(path string)
MakeDestination creates directory if it doesn't exist
func UnmarshallAllowedZones ¶
func UnmarshallAllowedZones(allowedZones **Allowedzones) (err error)
unmarshallAllowedZones reads the info from provided json file and fills struct with the needed info.
func UnmarshallBlockedZones ¶
func UnmarshallBlockedZones(blockedZones **Blockedzones) (err error)
unmarshallBlockedZones reads the info from provided json file and fills struct with the needed info.
func UnmarshallCountries ¶
func UnmarshallCountries(continents **Continents) (err error)
unmarshallCountries reads the info from provided json file and fills struct with the needed info.
Types ¶
type Allowedzones ¶
type Allowedzones struct {
CIDR []string `json:"allowed"`
}
Allowedzones contains zones that should be explicitely allowed see exclzones.json file
type Blockedzones ¶
type Blockedzones struct {
CIDR []string `json:"blocked"`
}
Blockedzones contains zones that should be explicitely blocked see inclzones.json file
type Continents ¶
type Continents struct { Afrika Zones `json:"AFRICA"` Asia Zones `json:"ASIA"` Europe Zones `json:"EUROPE"` NorthAmerica Zones `json:"NORTH_AMERICA"` SouthAmerica Zones `json:"SOUTH_AMERICA"` Oceania Zones `json:"OCEANIA"` Antartica Zones `json:"ANTARTICA"` }
Continents contains the ISO-3166-1 style country codes extracted from .uca-exclcountries.json divided by continent
type GH_ssh_fp ¶
type GH_ssh_fp struct { RSA string `json:"SHA256_RSA"` ECDSA string `json:"SHA256_ECDSA"` ED25519 string `json:"SHA256_ED25519"` }
GH_ssh_fp contains the ssh fingerprint from GitHub meta endpoint
type GitHub ¶
type GitHub struct { VPA bool `json:"verifiable_password_authentication"` SSH_fp GH_ssh_fp `json:"ssh_key_fingerprints"` Hooks []string `json:"hooks"` Web []string `json:"web"` API []string `json:"api"` Git []string `json:"git"` Packages []string `json:"packages"` Pages []string `json:"pages"` Importer []string `json:"importer"` Actions []string `json:"actions"` Dependabot []string `json:"dependabot"` }
GitHub is the base struct containing the data fetched from https://api.github.com/meta