Documentation ¶
Index ¶
- Constants
- Variables
- func AddressCount(network *net.IPNet) uint64
- func AddressRange(network *net.IPNet) (net.IP, net.IP)
- func Dec(IP net.IP) net.IP
- func GenerateSecureToken(length int) string
- func Host(base *net.IPNet, num int) (net.IP, error)
- func Inc(IP net.IP) net.IP
- func ListAddresses(network *net.IPNet) []net.IP
- func NextSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool)
- func PreviousSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool)
- func SubmitFaiure(w http.ResponseWriter, statusCode int, message string)
- func SubmitSuccess(w http.ResponseWriter, message string)
- func Subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error)
- func VerifyNoOverlap(subnets []*net.IPNet, CIDRBlock *net.IPNet) error
- type ApiAction
- type ContextKey
- type MimeType
- type RestMethod
- type RestProtocol
Constants ¶
const ( //Plain Text format Mime Type PLAIN_TEXT_MIME_TYPE MimeType = "text/plain" //Json format Mime Type JSON_MIME_TYPE MimeType = "application/json" //Xml format Mime Type XML_MIME_TYPE MimeType = "application/xml" //Yaml format Mime Type YAML_MIME_TYPE MimeType = "text/yaml" //Zip Archive format Mime Type ZIP_ARCHIVE_MIME_TYPE MimeType = "application/zip" //Binary Data format Mime Type BINARY_DATA_MIME_TYPE MimeType = "application/octet-stream" //Rest Web Method: GET REST_METHOD_GET RestMethod = http.MethodGet //Rest Web Method: POST REST_METHOD_POST RestMethod = http.MethodPost //Rest Web Method: POST (FORM) REST_METHOD_POST_FORM RestMethod = http.MethodPost + "_FORM" //Rest Web Method: HEAD REST_METHOD_HEAD RestMethod = http.MethodHead //Rest Web Method: CONNECT REST_METHOD_CONNECT RestMethod = http.MethodConnect //Rest Web Method: DELETE REST_METHOD_DELETE RestMethod = http.MethodDelete //Rest Web Method: OPTIONS REST_METHOD_OPTIONS RestMethod = http.MethodOptions //Rest Web Method: PATCH REST_METHOD_PATCH RestMethod = http.MethodPatch //Rest Web Method: PUT REST_METHOD_PUT RestMethod = http.MethodPut //Rest Web Method: TRACE REST_METHOD_TRACE RestMethod = http.MethodTrace //Rest Web Protocol: HTTP REST_PROTOCOL_HTTP RestProtocol = "http" //Rest Web Protocol: HTTPS REST_PROTOCOL_HTTPS RestProtocol = "https" //Rest Web Protocol: WS REST_PROTOCOL_WS RestProtocol = "ws" )
Variables ¶
var ( // Session Context Key ContextSessionKey = ContextKey("session-key") // Session Context Auth Token ContextKeyAuthtoken = ContextKey("auth-token") // Session Context Remote Address ContextRemoteAddress = ContextKey("remote-address") )
Functions ¶
func AddressCount ¶
AddressCount returns the number of distinct host addresses within the given CIDR range.
Since the result is a uint64, this function returns meaningful information only for IPv4 ranges and IPv6 ranges with a prefix size of at least 65.
func AddressRange ¶
AddressRange returns the first and last addresses in the given CIDR range.
func GenerateSecureToken ¶
Generate a Security Token of a given length
func Host ¶
Host takes a parent CIDR range and turns it into a host IP address with the given host number.
For example, 10.3.0.0/16 with a host number of 2 gives 10.3.0.2.
func ListAddresses ¶
ListAddresses returns the list of all addresses in the given CIDR range.
func NextSubnet ¶
NextSubnet returns the next available subnet of the desired mask size starting for the maximum IP of the offset subnet If the IP exceeds the maxium IP then the second return value is true
func PreviousSubnet ¶
PreviousSubnet returns the subnet of the desired mask in the IP space just lower than the start of IPNet provided. If the IP space rolls over then the second return value is true
func SubmitFaiure ¶
func SubmitFaiure(w http.ResponseWriter, statusCode int, message string)
Submit Failure Data To the client
func SubmitSuccess ¶
func SubmitSuccess(w http.ResponseWriter, message string)
Submit Success Data To the client
Types ¶
type ApiAction ¶
type ApiAction interface { // Execute API command with API given arguments Run(Args ...interface{}) error }
Interface that describes the callback action of an API call
type ContextKey ¶
type ContextKey string
Context Key Type
func (ContextKey) String ¶
func (c ContextKey) String() string