mdurl

package module
v0.0.0-...-8d018c6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: BSD-2-Clause Imports: 4 Imported by: 4

README

This repository has moved to gitlab.com/golang-commonmark/mdurl.

Documentation

Overview

Package url provides functions for parsing, decoding and encoding URLs.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingScheme = errors.New("missing protocol scheme")

ErrMissingScheme error is returned by Parse if the passed URL starts with a colon.

Functions

func Decode

func Decode(rawurl string) string

Decode decodes a percent-encoded URL. Invalid percent-encoded sequences are left as is. Invalid UTF-8 sequences are replaced with U+FFFD.

func Encode

func Encode(rawurl string) string

Encode percent-encodes rawurl, avoiding double encoding. It doesn't touch: - alphanumeric characters ([0-9a-zA-Z]); - percent-encoded characters (%[0-9a-fA-F]{2}); - excluded characters ([;/?:@&=+$,-_.!~*'()#]). Invalid UTF-8 sequences are replaced with U+FFFD.

Types

type URL

type URL struct {
	Scheme      string
	RawScheme   string
	Slashes     bool
	Auth        string
	Host        string
	Port        string
	Path        string
	RawQuery    string
	HasQuery    bool
	Fragment    string
	HasFragment bool
	IPv6        bool
}

A URL represents a parsed URL.

func Parse

func Parse(rawurl string) (*URL, error)

Parse parses rawurl into a URL structure.

func (*URL) String

func (u *URL) String() string

String reassembles the URL into a URL string.

Jump to

Keyboard shortcuts

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