Documentation ¶
Overview ¶
This package contains functions useful to two or more of the other binaries/pkgs.
Index ¶
- Variables
- func FixQuery(query, file string) string
- func GetCommentsDir() string
- func GetCommentsFile(file string) string
- func GetConfigPath() string
- func GetLikesDir() string
- func GetQueryAndIP() (string, string, error)
- func GetTmpDir() string
- func HandleErr(err error)
- func IsFileValid(file string) bool
- func PathEscape(path string) string
- func PathExists(path string) bool
- func Respond(gmi string)
- func RespondError(reason string)
- func RespondInput(prompt string)
- func SafeInit() error
- func SanitizeIP(ip string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrConfigDir = errors.New("config dir invalid or not set")
Functions ¶
func FixQuery ¶
FixQuery removes the file string from the beginning of the query. Some clients just append the query string, which results in query strings like this: `?file.gmi?username comment text`. This removes the file part.
func GetCommentsDir ¶
func GetCommentsDir() string
func GetCommentsFile ¶
func GetConfigPath ¶
func GetConfigPath() string
func GetLikesDir ¶
func GetLikesDir() string
func GetQueryAndIP ¶
func IsFileValid ¶
IsFileValid returns a true if that file is actionable. ie, it can be commented on and liked.
func PathEscape ¶ added in v1.0.2
func PathExists ¶
func RespondError ¶
func RespondError(reason string)
func RespondInput ¶
func RespondInput(prompt string)
func SafeInit ¶
func SafeInit() error
SafeInit makes sure all the required data directories are created. It can be called multiple times safely.
It should be called and checked before doing any other operation.
func SanitizeIP ¶
SanitizeIP makes IPs filename safe. It changes IPv6 colons to underscores.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.