utils

package
Version: v0.0.0-...-06de07e Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: MIT Imports: 5 Imported by: 7

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 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.

Source Files

Jump to

Keyboard shortcuts

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