Documentation ¶
Overview ¶
(c) Kamiar Bahri
(c) Kamiar Bahri
(c) Kamiar Bahri
(c) Kamiar Bahri
(c) Kamiar Bahri
Index ¶
- Constants
- func ConsoleClearLastLine()
- func CreateHash(key string) string
- func DecryptLight(data []byte, passphrase string) ([]byte, error)
- func EncryptLight(data []byte, passphrase string) ([]byte, error)
- func FileOrDirExists(path string) bool
- func RemoveItemFromIntArry(s []interface{}, i int) []interface{}
- func SetEnvFromFile(envFile string) error
- type CzdsAPI
- type HTTPResult
- type ICzdsAPI
- type IIcannAPI
- type IcannAPI
- type IcannClient
- type JWT
- type TeeWriter
- type ZoneFileStatus
Constants ¶
const ( GET = "GET" HEAD = "HEAD" POST = "POST" )
Variables ¶
This section is empty.
Functions ¶
func ConsoleClearLastLine ¶
func ConsoleClearLastLine()
func DecryptLight ¶
DecryptLight --d
func FileOrDirExists ¶
FileOrDirExists checks to see if a file or dir exist. Note that os.Stat(path) works for any path (file or directory).
func RemoveItemFromIntArry ¶ added in v1.1.1
func RemoveItemFromIntArry(s []interface{}, i int) []interface{}
func SetEnvFromFile ¶
SetEnvFromFile read target key/val from the icann.env file. It encrypts plain-text values before returning.
Types ¶
type CzdsAPI ¶
type CzdsAPI struct {
// contains filtered or unexported fields
}
CzdsAPI implements the ICzdsAPI interface.
func (*CzdsAPI) DownloadZoneFile ¶
func (c *CzdsAPI) DownloadZoneFile(localFilePath string, downloadLink string, wg *sync.WaitGroup) (int, error)
DownloadZoneFile downloads a zone file from an assigned link.
type HTTPResult ¶
type ICzdsAPI ¶
type ICzdsAPI interface { DownloadZoneFile(localFilePath string, downloadLink string, wg *sync.WaitGroup) (int, error) ICANN() *IcannAPI Run() }
ICzdsAPI is the interface for CzdsAPI.
type IIcannAPI ¶
type IIcannAPI interface { Authenticate() HTTPExec(method string, url string, hd http.Header, data []byte) HTTPResult GetCommonHeaders() http.Header Run() // contains filtered or unexported methods }
ICannAPI interface performs the basic funtions to interact with the ICANN's API.
type IcannAPI ¶
type IcannAPI struct { // AppDataDir is the directory (on the volume) that zone files will be downloaded to. AppDataDir string // UserAgent is required for all ICANN API calls; its format is: // <name of you product> / <version> <comment about your product> UserAgent string // ICANN person account username. UserName string // Password is the ICANN person account password. Password string // ApprovedTLD is an array of TLDs e.g. com, net. ApprovedTLD []string // Authenticated is used by callers to get the status of the authentication. Authenticated bool // AccessToken is available to callers to use for Bearer in the Authorization header. AccessToken JWT HoursToWaitBetweenDownloads int // contains filtered or unexported fields }
IcannAPI defines the structure of the IIcannAPI interface.
func (*IcannAPI) Authenticate ¶
func (i *IcannAPI) Authenticate()
Authenticate calls the authenticate and retreives an access code, which can be used by the ICzdsAPI interface.
func (*IcannAPI) GetCommonHeaders ¶
GetCommonHeaders gets the headers required by icann api.
type IcannClient ¶
func NewIcannAPIClient ¶
func NewIcannAPIClient() *IcannClient
NewIcannAPIClient creates a new instance of the icann interface. It runs the authentication immediately.
type TeeWriter ¶
type TeeWriter struct { TotalDownloaded uint64 File *os.File TempFilePath string FileName string TLDType string StartTime time.Time }
TeeWriter defines the structure of the callback, to get status of the download in porgress.
type ZoneFileStatus ¶
type ZoneFileStatus struct { HTTPResult HTTPResult OriginalFileName string // e.g. com.txt.gz FileLength uint64 TLDType string // e.g. com }