glue: github.com/desertbit/glue/utils Index | Files

package utils

import "github.com/desertbit/glue/utils"

Package utils provides utilities for the glue socket implementation.

Index

Package Files

utils.go

func MarshalValues Uses

func MarshalValues(first, second string) string

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

func RandomString Uses

func RandomString(n int) string

RandomString generates a random string.

func RemoteAddress Uses

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 RemovePortFromRemoteAddr Uses

func RemovePortFromRemoteAddr(remoteAddr string) string

RemovePortFromRemoteAddr removes the port if present from the remote address.

func UnmarshalValues Uses

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.

Package utils imports 5 packages (graph) and is imported by 8 packages. Updated 2016-08-01. Refresh now. Tools for package owners.