Documentation
¶
Index ¶
- func GetNativeEndian() binary.ByteOrder
- func Htonl(i uint32) uint32
- func Htons(i uint16) uint16
- func IPv4StrToU32(s string) (ip uint32)
- func IPv4ToU32(ip net.IP) uint32
- func IsLittleEndian() bool
- func IsReservedIP(ip string) int
- func Ntohl(i uint32) uint32
- func Ntohs(i uint16) uint16
- func QueryGetParam(query, key string) (string, error)
- func QueryGetParams(query, key string) ([]string, error)
- func RawURLAddParam(raw, key, value string) (string, error)
- func RawURLAddParams(raw string, params map[string]string) (string, error)
- func RawURLDelParams(raw string, keys ...string) (string, error)
- func RawURLGetAllParams(raw string) (map[string][]string, error)
- func RawURLGetDomain(rawURL string) (string, error)
- func RawURLGetParam(raw, key string) (string, error)
- func RawURLGetParams(raw, key string) ([]string, error)
- func RawURLGetPort(raw string) (string, error)
- func RawURLSetParam(raw, key, value string) (string, error)
- func RawURLSetParams(rawURL string, params map[string]string) (string, error)
- func Swap16(i uint16) uint16
- func Swap32(i uint32) uint32
- func U32ToIPv4(ip uint32) net.IP
- func U32ToIPv4Str(ip uint32) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNativeEndian ¶
GetNativeEndian gets byte order for the current system.
func Htonl ¶
Htonl convert uint32 from host byte order to network byte order. Network byte order is BigEndian.
func Htons ¶
Htons convert uint16 from host byte order to network byte order. Network byte order is BigEndian.
func IPv4StrToU32 ¶
IPv4StrToU32 converts IPv4 string to uint32 in host byte order.
func IsLittleEndian ¶
func IsLittleEndian() bool
IsLittleEndian determines whether the host byte order is little endian.
func IsReservedIP ¶
IsReservedIP reports whether ip is private. Support ipv4/ipv6, refer rfc6890. Return <0 ip is invalid, =0 ip is public, >0 ip is private.
func QueryGetParam ¶
QueryGetParam gets the specified key parameter from query string. The input is encoded query values without '?' and key is parameter name. E.g. if query string is "a=dog&b=tiger" and key is "a" will return dog.
func QueryGetParams ¶
QueryGetParams gets the specified key parameters from query string. Rawquery is encoded query values without '?' and key is parameter name. E.g. if query is "a=dog&a=cat&b=tiger" and key is "a" QueryGetParams will return [dog cat]
func RawURLAddParam ¶
RawURLAddParam adds query parameter to raw url. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name and key=page value=3 will get http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2&page=3#name.
func RawURLAddParams ¶
RawURLAddParams adds multiple query parameters to raw url.
func RawURLDelParams ¶
RawURLDelParams deletes multiple query paramters from raw url.
func RawURLGetAllParams ¶
RawURLGetAllParams gets all query parameter for all keys from raw url. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name will get map[boardID:[520] page:[1 2]].
func RawURLGetDomain ¶
RawURLGetDomain gets the domain from raw url. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name will get www.aspxfans.com.
func RawURLGetParam ¶
RawURLGetParam gets the first query parameter for the specified key from raw url, even though key has multiple parameters. E.g. rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name and key="page" will get "1".
func RawURLGetParams ¶
RawURLGetParams gets all query parameter for the specified key from raw url if key has multiple parameters. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name and key=page will get [1 2].
func RawURLGetPort ¶
RawURLGetPort gets the port from raw url. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name will get 8080.
func RawURLSetParam ¶
RawURLSetParam sets query paramter to raw url. If the query key does not exist, it will be added to the url. E.g. if rawURL=http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=1&page=2#name and key=page value=3 will get http://www.aspxfans.com:8080/news/index.asp?boardID=520&page=3#name.
func RawURLSetParams ¶
RawURLSetParams sets multiple query paramter to raw url.
func U32ToIPv4Str ¶
U32ToIPv4Str converts uint32 to IPv4 string in host byte order.
Types ¶
This section is empty.