common

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KillswitchStringLength  int    = 20
	BlocklistApprovedString string = "approved"
	BlocklistDeniedString   string = "denied"
	HandleIdName            string = "PRIVATE_HANDLEID_"
	DefaultTrustLimit       int64  = 100
	MASTER_ACCOUNT          string = "token"

	LOCAL_SECRET           = "LOCAL"
	VAULT_SECRET           = "VAULT"
	AWS_SECRET             = "AWS"
	HASHICORP_VAULT_SECRET = "HASHICORP_VAULT"
)
View Source
const (
	//True and False : string constant for query parameters
	True    string = "true"
	False   string = "false"
	ISSUING string = "issuing"
	DEFAULT string = "default"
)
View Source
const Separator = "*"

Separator seperates the name and domain portions of an address

Variables

View Source
var (
	// ErrInvalidAddress is the error returned when an address is invalid in
	// such a way that we do not know if the name or domain portion is at fault.
	ErrInvalidAddress = errors.New("invalid address")

	// ErrInvalidName is the error returned when an address's name portion is
	// invalid.
	ErrInvalidName = errors.New("name part of address is invalid")

	// ErrInvalidDomain is the error returned when an address's domain portion
	// is invalid.
	ErrInvalidDomain = errors.New("domain part of address is invalid")
)
View Source
var LOGGER = logging.MustGetLogger("common")

Functions

func Abs

func Abs(p string) string

func Cat

func Cat(arguments ...string) string

Concatenates given number of string arguments

func FloatToFixedPrecisionString

func FloatToFixedPrecisionString(input_num float64, precision int) string

func FloatToString

func FloatToString(input_num float64) string

func GetHorizonClient

func GetHorizonClient(urlString string) horizon.Client

We should use this method only to point to horizon client that we want this way we can use our own standalone horizon client

func GetNewHorizonClient

func GetNewHorizonClient(urlString string) hClient.Client

func GetStellarNetwork

func GetStellarNetwork(passphrase string) b.Network

func IntToString

func IntToString(input_num int64) string

func IsAlphanumeric

func IsAlphanumeric(h string) bool

func IsSafePath

func IsSafePath(p string) bool

It is important to use absolute /canonical paths in order to avoid Path Traversal attacks

func Retry

func Retry(retry_times float64, interval time.Duration, fn func() error) error

For retrying invoking function until time is up or function successfully return result. Can pass math.Inf(1) as retry_times for infinite retries.

func SetCSP

func SetCSP(w http.ResponseWriter)

Setting content Security policy

func SetCacheControl

func SetCacheControl(w http.ResponseWriter)
 	39844: Cacheable HTTPS response (Informational)
	Setting Cache-control

func SetContentType

func SetContentType(w http.ResponseWriter)
 	39845: Input returned in response (Reflected) (Low)
	Setting Pragma

func SetHSTS

func SetHSTS(w http.ResponseWriter)

This header is set to prevent HSTS attacks

func SetOrigin

func SetOrigin(w http.ResponseWriter)

func SetPragma

func SetPragma(w http.ResponseWriter)
 	39844: Cacheable HTTPS response (Informational)
	Setting Pragma

func SetXCTO

func SetXCTO(w http.ResponseWriter)
 	39842: Missing X-Content-Type-Options Header (Informational)
	Setting X Content Type Options

func SetXXSS

func SetXXSS(w http.ResponseWriter)
 	39840: Missing X-XSS-Protection Header (Informational)
	Setting X-XSS-Protection

func Split

func Split(address string) (name, domain string, err error)

Split takes an address, of the form "name*domain" and provides the constituent elements.

func StrPtr

func StrPtr(str string) *string

func ToFixedPrecision

func ToFixedPrecision(num float64, precision int) float64

func ValidateHash

func ValidateHash(h string) bool

validate a hash for checkmarx

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL