utils

package
v0.0.0-...-ea08b5a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utils - BitMonster utilities

Package utils - BitMonster utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalValues

func MarshalValues(first, second string) string

MarshalValues joins two values into a single string. They can be decoded by the UnmarshalValues function.

func RandomString

func RandomString(n int) string

RandomString generates a random string.

func RemoteAddress

func RemoteAddress(r *http.Request) (string, bool)

RemoteAddress returns the IP address of the request. If the X-Forwarded-For or X-Real-Ip http headers are set, then they are used to obtain the remote address. The boolean is true, if the remote address is obtained using the request RemoteAddr() method.

func RemoveDuplicateStrings

func RemoveDuplicateStrings(a []string) []string

RemoveDuplicateStrings removes duplicate strings from a string slice.

func RemovePortFromRemoteAddr

func RemovePortFromRemoteAddr(remoteAddr string) string

RemovePortFromRemoteAddr removes the port if present from the remote address.

func UUID

func UUID() string

UUID generates an UUID Version 4.

func UnmarshalValues

func UnmarshalValues(data string) (first, second string, err error)

UnmarshalValues splits two values from a single string. This function is chainable to extract multiple values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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