url

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

package url provides url fuctionalities to provide consistent parsing for Kwil clients.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownScheme = errors.New("unknown scheme")
)

Functions

This section is empty.

Types

type Scheme

type Scheme string

Scheme is a protocol scheme, such as http or tcp.

const (
	HTTP  Scheme = "http"
	HTTPS Scheme = "https"
	TCP   Scheme = "tcp"
	UNIX  Scheme = "unix"
)

func (Scheme) String

func (s Scheme) String() string

type URL

type URL struct {
	// Original is the original URL string.
	Original string
	// Scheme is the protocol scheme, such as http or tcp.
	Scheme Scheme
	// Target is either the host, host:port, or unix socket path.
	Target string
	// Port is the port number, or 0 if not specified.
	Port int
}

URL is a parsed URL.

func ParseURL

func ParseURL(u string) (*URL, error)

ParseURL parses a URL string into a URL struct. URLs can be of the form: - http://localhost:8080 - tcp://localhost:8080 - localhost:8080 - localhost - unix:///var/run/kwil.sock If the URL does not have a scheme, it is assumed to be a tcp address.

Jump to

Keyboard shortcuts

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