utils

package
v0.0.0-...-474e83c Latest Latest
Warning

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

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

Documentation

Overview

Package utils provides utilities for the glue socket implementation.

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 RemovePortFromRemoteAddr

func RemovePortFromRemoteAddr(remoteAddr string) string

RemovePortFromRemoteAddr removes the port if present from the remote address.

func UUID

func UUID() string

UUID returns a new unique version 4 UUID as string.

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