service_file

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Header = "<?xml version=\"1.0\" standalone='no'?><!--*-nxml-*-->\n<!DOCTYPE service-group SYSTEM \"avahi-service.dtd\">\n"

Variables

This section is empty.

Functions

func Write

func Write(sg ServiceGroup, path string) error

Types

type IPVer

type IPVer = string
const (
	IPvAny IPVer = "any"
	IPv4   IPVer = "ipv4"
	IPv6   IPVer = "ipv6"
)

type Name

type Name struct {
	XMLName          xml.Name `xml:"name"`
	ReplaceWildcards string   `xml:"replace-wildcards,attr"` // (yes|no) default: "no"
	Value            string   `xml:",chardata"`
}

type Protocol

type Protocol = string
const (
	ProtocolTcp Protocol = "tcp"
	ProtocolUdp Protocol = "udp"
)

type Service

type Service struct {
	XMLName    xml.Name    `xml:"service"`
	Protocol   string      `xml:"protocol,attr"` // (ipv4|ipv6|any) default: "any"
	Type       string      `xml:"type"`
	Subtypes   []Subtype   `xml:"subtype,omitempty"`
	DomainName string      `xml:"domain-name,omitempty"`
	HostName   string      `xml:"host-name,omitempty"`
	Port       string      `xml:"port"`
	TxtRecords []TxtRecord `xml:"txt-record,omitempty"`
}

func NewService

func NewService(sType string, subTypes []Subtype, port uint, ipVer IPVer, domainName, hostName string, txtRecords []TxtRecord) (Service, error)

type ServiceGroup

type ServiceGroup struct {
	XMLName  xml.Name `xml:"service-group"`
	Name     Name
	Services []Service `xml:"service"`
}

func NewServiceGroup

func NewServiceGroup(name string, nameReplaceWildcards bool, services []Service) (ServiceGroup, error)

func Read

func Read(path string) (ServiceGroup, error)

type Subtype

type Subtype struct {
	XMLName xml.Name `xml:"subtype"`
	Value   string   `xml:",chardata"`
}

func NewSubtype

func NewSubtype(sType string) (Subtype, error)

type TxtRecord

type TxtRecord struct {
	XMLName     xml.Name `xml:"txt-record"`
	ValueFormat string   `xml:"value-format,attr"` // (text|binary-hex|binary-base64) default: "text"
	Value       string   `xml:",chardata"`
}

func NewTxtRecord

func NewTxtRecord(value string, valueFormat ValueFormat) (TxtRecord, error)

type ValueFormat

type ValueFormat = string
const (
	ValueFormatText         ValueFormat = "text"
	ValueFormatBinaryHex    ValueFormat = "binary-hex"
	ValueFormatBinaryBase64 ValueFormat = "binary-base64"
)

Jump to

Keyboard shortcuts

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