Documentation ¶
Index ¶
- Variables
- func ApplyFilter(filter []*FilterType, mdata map[string]interface{}) bool
- func DelFromSliceString(s []string, nth int) (rv []string)
- func DumpReCache()
- func Exists(name string) bool
- func ExistsGetFileInfo(name string) (bool, os.FileInfo)
- func ExistsGetUDate(name string) (bool, os.FileInfo)
- func ExistsIsDir(name string) bool
- func ExistsIsExecutable(name string) bool
- func ExternalIP() (rv []string, err error)
- func FilepathAbs(fn string) (rfn string)
- func FirstName(ww map[string]interface{}) (rv string)
- func Fopen(fn string, mode string) (file *os.File, err error)
- func GenSHA(data []byte) (s string)
- func GenURL(www http.ResponseWriter, req *http.Request) (url string, hUrl string)
- func GenURLFromReq(req *http.Request) (url string)
- func GenURLFromReqProxy(req *http.Request, newHost string) (url string)
- func GetCTypes(www http.ResponseWriter, bod []byte) (ctypes []string)
- func GetCookie(name string, req *http.Request) (rv string)
- func GetExtenstionBasedOnMimeType(mt string) (ext string)
- func GetFileSize(fn string) int64
- func GetFilenames(dir string) (filenames, dirs []string)
- func GetFilenamesSorted(dir string) (filenames, dirs []string)
- func GetIP(req *http.Request) (ip string)
- func GetImageDimension(imagePath string) (width int, height int)
- func GetIpFromReq(req *http.Request) (ip string, err error)
- func GetPackageName(fnln string) (newFn, pkg string)
- func GetPort(req *http.Request) (rv string)
- func GetRemoteIP(req *http.Request) string
- func GetUUIDAsString() (rv string)
- func HasHeader(wr http.ResponseWriter, name string) (val string, found bool)
- func HashStrings(a ...string) string
- func InArray(lookFor string, inArr []string) bool
- func InArrayN(lookFor string, inArr []string) int
- func IntAbs(n int) int
- func IsErr(err error) (e error)
- func IsErrFatal(err error)
- func IsHtml(www http.ResponseWriter, bod []byte) bool
- func IsLocalPath(s string) bool
- func IsLocalhost(s string) bool
- func IsProtocal(s string) (rv bool)
- func JsonStringToArrayOfData(s string) (theJSON []map[string]interface{}, err error)
- func JsonStringToArrayOfString(s string) (theJSON []string, err error)
- func JsonStringToData(s string) (theJSON map[string]interface{}, err error)
- func JsonStringToString(s string) (theJSON map[string]string, err error)
- func LF(d ...int) string
- func LenOfMap(ww map[string]interface{}) (rv int)
- func LookupRe(pattern string) (rv *regexp.Regexp)
- func MatchPathInList(path string, pathList []string) bool
- func MatchURLPrefix(APath, Pattern string) bool
- func Md5sum(s string) (buf string)
- func ParseBool(s string) (bool, error)
- func PathsMatch(Paths []string, APath string) bool
- func PathsMatchIgnore(Paths []string, APath string) bool
- func PathsMatchN(Paths []string, APath string) int
- func PathsMatchPos(Paths []string, APath string) int
- func PathsMatchRe(Paths []string, APath string) bool
- func PathsMatchReN(Paths []string, APath string) int
- func ReadJsonFile(fn string) (jdata map[string]string, err error)
- func SVar(v interface{}) string
- func SVarI(v interface{}) string
- func SearchForFile(root []string, fn string) (string, bool)
- func SearchForFileSimple(root []string, fn string, index []string) (x string, ok bool)
- func SetMaxCPUs(numCPU int)
- func SetupRequestHeaders(req *http.Request, hdr []NameValue)
- func SetupTestCreateDirs()
- func SetupTestCreateDirsFileServe()
- func SetupTestMimicReq(req *http.Request, h string)
- func Sha256(s string) (rv string)
- func TimeZero() (z time.Time)
- type FilterType
- type MimeType
- type NameValue
- type OpType
- type ProtocalType
- type ReCacheType
Constants ¶
This section is empty.
Variables ¶
var BoolError = errors.New("Invalid boolean value")
var ErrFailedToParse = errors.New("Error in parsing filter")
var OpLookup map[string]OpType
var OpLookupStr map[OpType]string
Functions ¶
func ApplyFilter ¶
func ApplyFilter(filter []*FilterType, mdata map[string]interface{}) bool
func DelFromSliceString ¶
Remove the `nth` element from the slice `s` returning the modified slice. If `nth` is out of range then just return the input `s`
func DumpReCache ¶
func DumpReCache()
func ExistsGetFileInfo ¶
-------------------------------------------------------------------------------------------------
type FileInfo interface { Name() string // base name of the file Size() int64 // length in bytes for regular files; system-dependent for others Mode() FileMode // file mode bits ModTime() time.Time // modification time IsDir() bool // abbreviation for Mode().IsDir() Sys() interface{} // underlying data source (can return nil) }
Exists reports whether the named file or directory exists. -------------------------------------------------------------------------------------------------
func ExistsIsDir ¶
func ExistsIsExecutable ¶
Check that a file exists and is an executable program - Linux/Unix/MacOS - 'x' permissions && not a directory
func ExternalIP ¶
Return a list of IPs that are listend to by this system.
func FilepathAbs ¶
func GenURL ¶
Return the full URL with http://host:port/path/path?arg=value
func GenURLFromReq ¶
------------------------------------------------------------------------------------------------- Convert from a request back to a URL
func GenURLFromReqProxy ¶
------------------------------------------------------------------------------------------------- Convert from a request back to a URL
func GetCookie ¶
cookieValue := lib.GetCookie ( "LoginAuthCookie", req ) -------------------------------------------------------------------------------------------------
func GetExtenstionBasedOnMimeType ¶
function to get extension based on mime type
func GetFilenames ¶
------------------------------------------------------------------------------------------------- Get a list of filenames and directorys.
func GetFilenamesSorted ¶
-------------------------------------------------------------------------------------------------
func GetImageDimension ¶
GetImageDimension returns width, height of an immage - .png, .jpg, .gif
- not working on .svg
- not returning errors
Example:
h, w = GetHWFromImage ( ffile_name );
func GetIpFromReq ¶
-------------------------------------------------------------------------------------------------
func GetPackageName ¶
func GetRemoteIP ¶
func GetUUIDAsString ¶
func GetUUIDAsString() (rv string)
func HasHeader ¶
func HasHeader(wr http.ResponseWriter, name string) (val string, found bool)
------------------------------------------------------------------------------------------------- func (hdlr RedirectHandlerType) ServeHTTP(www http.ResponseWriter, req *http.Request) {
func HashStrings ¶
func InArray ¶
-------------------------------------------------------------------------------------------------
func InArrayN ¶
-------------------------------------------------------------------------------------------------
func IsErrFatal ¶
func IsErrFatal(err error)
func IsLocalPath ¶
func IsLocalhost ¶
IsLocalhost is true when passed a localhost IP address v4 or ipv6
func IsProtocal ¶
func JsonStringToArrayOfData ¶
func JsonStringToArrayOfString ¶
c_parsed, err2 := lib.JsonStringToArrayOfString ( b )
func JsonStringToData ¶
func MatchPathInList ¶
xyzzy - test this Match a path in a list of paths
func MatchURLPrefix ¶
MatchURLPrefix is a week regular exprssion matcher. Only 1 patterns are supported. Valid in URL chars are: A-Z, a-z, 0-9, -, ., _, ~, :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, and = ^ for either / or EOL
func PathsMatch ¶
----------------------------------------------------------------------------------------------------------------------------------------------------
func PathsMatchIgnore ¶
func PathsMatchN ¶
func PathsMatchPos ¶
func PathsMatchRe ¶
func PathsMatchReN ¶
func SVar ¶
func SVar(v interface{}) string
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
func SVarI ¶
func SVarI(v interface{}) string
-------------------------------------------------------------------------------------------------
func SearchForFile ¶
-------------------------------------------------------------------------------------------------
func SearchForFileSimple ¶
func SetMaxCPUs ¶
func SetMaxCPUs(numCPU int)
func SetupRequestHeaders ¶
lib.SetupRequestHeaders(req, test.hdr)
func SetupTestCreateDirs ¶
func SetupTestCreateDirs()
func SetupTestCreateDirsFileServe ¶
func SetupTestCreateDirsFileServe()
func SetupTestMimicReq ¶
Types ¶
type FilterType ¶
func ParseFilter ¶
func ParseFilter(ss string) (ff *FilterType, err error)
type ProtocalType ¶
type ProtocalType int
const ( HTTPProtocal ProtocalType = 1 HTTPSProtocal ProtocalType = 2 WSProtocal ProtocalType = 3 WSSProtocal ProtocalType = 4 FileProtocal ProtocalType = 5 ProxyProtocal ProtocalType = 6 )
func DetermineProtocal ¶
func DetermineProtocal(s string) (rv ProtocalType)
Looks at the leading part of a URL to determine the protocal, HTTPProtocal is the default
func (ProtocalType) String ¶
func (p ProtocalType) String() string