Documentation
¶
Index ¶
- Constants
- Variables
- func Blue(str string, color bool) string
- func Bold(str string, color bool) string
- func BuildHttpClient() *http.Client
- func DecryptText(ciphertext string, additionalData []byte) (string, error)
- func EncryptText(plaintext string, additionalData []byte) (string, error)
- func Fetch(client *http.Client, method, endpoint string, headers map[string]string) ([]byte, error)
- func FetchAsString(client *http.Client, method, endpoint string, headers map[string]string) (string, error)
- func FetchWithBody(client *http.Client, method, endpoint string, headers map[string]string, ...) ([]byte, error)
- func FetchWithBodyAsString(client *http.Client, method, endpoint string, headers map[string]string, ...) (string, error)
- func GetHttp(getUrl string) (int, string, error)
- func GetMacAddress() (string, error)
- func GetUserAgent() string
- func Green(str string, color bool) string
- func NormalizeDeveloperApiEndpoint(developerApiEndpoint string) string
- func OpenUrl(url string) error
- func ParseECDSASignatureToRs(signature []byte) ([]byte, error)
- func PostHttp(postUrl string, parameters map[string]string) (int, string, error)
- func ReadCacheFileWithEncryption(category, key string) (string, error)
- func ReadCacheFileWithEncryptionCallback(category, key string, options *ReadCacheOptions) (string, error)
- func ReadCacheWithEncryptionCallback(category, key string, cacheReadWrite CacheReadWrite, options *ReadCacheOptions) (string, error)
- func Red(str string, color bool) string
- func RemoveCacheFile(category, key string) error
- func Sha256ToBase32(message string) string
- func Sha256ToHex(message string) string
- func SleepSeconds(interval int64)
- func Under(str string, color bool) string
- func WBlue(str string) string
- func WBold(str string) string
- func WGreen(str string) string
- func WRed(str string) string
- func WUnder(str string) string
- func WYellow(str string) string
- func WithColor(str, termColor string, color bool) string
- func WriteCacheFileWithEncryption(category, key string, plaintext string) error
- func Yellow(str string, color bool) string
- type CacheReadWrite
- type ECDSASignature
- type EncryptedFileCacheReadWrite
- type ReadCacheOptions
- type StdErrOut
- type StringWithTime
- func (s *StringWithTime) IsExpired() bool
- func (s *StringWithTime) IsExpiredWithCustomFunc(isExpired func(time *StringWithTime) bool) bool
- func (s *StringWithTime) IsExpiringOrExpired() bool
- func (s *StringWithTime) IsExpiringOrExpiredWithCustomFunc(isExpiringOrExpired func(time *StringWithTime) bool) bool
- func (s *StringWithTime) Marshal() (string, error)
- type UrlBuilder
Constants ¶
View Source
const ( HttpMethodPut = "PUT" HttpMethodGet = "GET" HttpMethodPost = "POST" )
View Source
const ( Seed1 = ".alibaba_cloud_idaas_seed1" Seed2 = ".alibaba_cloud_idaas_seed2" )
View Source
const ( TermReset = "\033[0m" TermBold = "\033[1m" TermUnder = "\033[4m" TermRed = "\033[31m" TermGreen = "\033[32m" TermYellow = "\033[33m" TermBlue = "\033[34m" )
Variables ¶
View Source
var ( UnsafeSkipCertificateVerification = idaaslog.IsOn(os.Getenv(constants.EnvUnsafeSkipCertificateVerification)) RootCertificates = os.Getenv(constants.EnvRootCertificates) )
View Source
var ( IsNonStdOutTerminal = !terminal.IsTerminal(int(os.Stdout.Fd())) IsNonStdErrTerminal = !terminal.IsTerminal(int(os.Stderr.Fd())) IsNonTerminal = IsNonStdOutTerminal || IsNonStdErrTerminal )
View Source
var ( // EnableEncryptWithMac more secure when turns on, but more stable when off EnableEncryptWithMac = idaaslog.IsOn(os.Getenv(constants.EnvEnableEncryptWithMac)) )
View Source
var Stderr = StdErrOut{ // contains filtered or unexported fields }
View Source
var Stdout = StdErrOut{ // contains filtered or unexported fields }
View Source
var UserAgent = GetUserAgent()
Functions ¶
func BuildHttpClient ¶
func FetchAsString ¶
func FetchWithBody ¶
func FetchWithBodyAsString ¶
func GetMacAddress ¶
func GetUserAgent ¶
func GetUserAgent() string
func ParseECDSASignatureToRs ¶
ParseECDSASignatureToRs Parse DER format to R and S ECDSA DER format looks like below:
SEQUENCE {
INTEGER r
INTEGER s
}
Example:
SEQUENCE {
INTEGER: 0083ef88158ebfe6065c8c9a6e00724685309a42366ff9cdf38931c0203229127c
INTEGER: 29068abc9e216f18ac5a3831b9c7bfdb7289c757fcefda441b8cf41e774a98a9
}
func ReadCacheFileWithEncryptionCallback ¶
func ReadCacheFileWithEncryptionCallback(category, key string, options *ReadCacheOptions) (string, error)
func ReadCacheWithEncryptionCallback ¶
func ReadCacheWithEncryptionCallback(category, key string, cacheReadWrite CacheReadWrite, options *ReadCacheOptions) (string, error)
func RemoveCacheFile ¶
func Sha256ToBase32 ¶
func Sha256ToHex ¶
func SleepSeconds ¶
func SleepSeconds(interval int64)
Types ¶
type CacheReadWrite ¶
type ECDSASignature ¶
type EncryptedFileCacheReadWrite ¶
type EncryptedFileCacheReadWrite struct{}
type ReadCacheOptions ¶
type ReadCacheOptions struct {
Context map[string]interface{}
FetchContent func() (int, string, error)
ForceNew bool
AllowExpired bool
IsContentExpiringOrExpired func(time *StringWithTime) bool
IsContentExpired func(time *StringWithTime) bool
}
type StringWithTime ¶
type StringWithTime struct {
CacheTime int64 `json:"cache_time"`
Context map[string]interface{} `json:"context"`
Content string `json:"content"`
}
func UnmarshalStringWithTime ¶
func UnmarshalStringWithTime(str string) (*StringWithTime, error)
func (*StringWithTime) IsExpired ¶
func (s *StringWithTime) IsExpired() bool
func (*StringWithTime) IsExpiredWithCustomFunc ¶
func (s *StringWithTime) IsExpiredWithCustomFunc(isExpired func(time *StringWithTime) bool) bool
func (*StringWithTime) IsExpiringOrExpired ¶
func (s *StringWithTime) IsExpiringOrExpired() bool
func (*StringWithTime) IsExpiringOrExpiredWithCustomFunc ¶
func (s *StringWithTime) IsExpiringOrExpiredWithCustomFunc(isExpiringOrExpired func(time *StringWithTime) bool) bool
func (*StringWithTime) Marshal ¶
func (s *StringWithTime) Marshal() (string, error)
type UrlBuilder ¶
func NewUrlBuilder ¶
func NewUrlBuilder(path string) *UrlBuilder
func (*UrlBuilder) AddQuery ¶
func (b *UrlBuilder) AddQuery(key, value string)
func (*UrlBuilder) BuildUrl ¶
func (b *UrlBuilder) BuildUrl() string
Click to show internal directories.
Click to hide internal directories.