uri

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: LGPL-3.0 Imports: 2 Imported by: 1

Documentation

Overview

Package uri provides support for NDEF Payloads of URI type. It follows the NFC Forum URI Record Type Definition specification (NFCForum-TS-RTD_URI_1.0).

The Payload type implements the RecordPayload interface from ndef, so it can be used as ndef.Record.Payload.

Index

Constants

This section is empty.

Variables

View Source
var URIProtocols = map[byte]string{
	0:  "",
	1:  "http://www.",
	2:  "https://www.",
	3:  "http://",
	4:  "https://",
	5:  "tel:",
	6:  "mailto:",
	7:  "ftp://anonymous:anonymous@",
	8:  "ftp://ftp.",
	9:  "ftps://",
	10: "sftp://",
	11: "smb://",
	12: "nfs://",
	13: "ftp://",
	14: "dev://",
	15: "news:",
	16: "telnet://",
	17: "imap:",
	18: "rtsp://",
	19: "urn:",
	20: "pop:",
	21: "sip:",
	22: "sips:",
	23: "tftp:",
	24: "btspp://",
	25: "btl2cap://",
	26: "btgoep://",
	27: "tcpobex://",
	28: "irdaobex://",
	29: "file://",
	30: "urn:epc:id:",
	31: "urn:epc:tag:",
	32: "urn:epc:pat:",
	33: "urn:epc:raw:",
	34: "urn:epc:",
	35: "urn:nfc:",
}

URIProtocols provides a mapping between the first byte if a NDEF Payload of type "U" (URI) and the string value for the protocol.

Functions

This section is empty.

Types

type Payload

type Payload struct {
	IdentCode byte
	URIField  string
}

Payload represents a NDEF Record Payload of Type "U".

func New

func New(uriStr string) *Payload

New returns a pointer to an Payload object. The Identifier code is automatically set based on the provided string.

func (*Payload) Len

func (u *Payload) Len() int

Len is the length of the byte slice resulting of Marshaling.

func (*Payload) Marshal

func (u *Payload) Marshal() []byte

Marshal returns the bytes representing the payload of a Record of URI type.

func (*Payload) String

func (u *Payload) String() string

String returns the URI string.

func (*Payload) Type

func (u *Payload) Type() string

Type returns the Uniform Resource Name for URIs.

func (*Payload) Unmarshal

func (u *Payload) Unmarshal(buf []byte)

Unmarshal parses the payload of a URI type record.

Jump to

Keyboard shortcuts

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