pkg

package
v0.0.0-...-f59cb8c Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandConfig = []*Command{
	{
		Name: "contact",
		SubCommand: []*Command{
			{
				Name: "check",
				DefaultData: &ContactCheck{
					ContactIDs: []string{
						"contact-1",
					},
					ClTrID: "ABC-123",
				},
				Template: "contact_check.xml",
			}, {
				Name: "create",
				DefaultData: &ContactCreate{
					ID: "contact-1",
					PostalInfo: []*PostalInfo{{
						Location:     "loc",
						Name:         "My Office",
						Organization: "My Org",
						Address: &PostalAddress{
							Street: []string{
								"Drottninggatan",
							},
							City:        "Stockholm",
							PostalCode:  "12345",
							CountryCode: "SE",
						},
					}},
					Voice: &VoiceFax{
						X:      "46",
						Number: "+46.070123456",
					},
					Email: "abc@def.se",
					Disclose: &Disclose{
						Disclose:  null.BoolFrom(true).Ptr(),
						LocalName: true,
						Fax:       true,
					},
					OrganisationNumber:  "[SE]802405-0190",
					ValueAddedTaxNumber: "SE802405019001",
					ClTrID:              "ABC-123",
				},
				Template: "contact_create.xml",
			}, {
				Name: "delete",
				DefaultData: &ContactDelete{
					ID:     "contact-1",
					ClTrID: "ABC-123",
				},
				Template: "contact_delete.xml",
			}, {
				Name: "info",
				DefaultData: &ContactInfo{
					ID:     "contact-1",
					ClTrID: "ABC-123",
				},
				Template: "contact_info.xml",
			}, {
				Name: "update",
				DefaultData: &ContactUpdate{
					ID:     "contact-1",
					ClTrID: "ABC-123",
				},
				Template: "contact_update.xml",
			},
		},
	},
	{
		Name: "domain",
		SubCommand: []*Command{
			{
				Name: "check",
				DefaultData: &DomainCheck{
					DomainNames: []string{
						"domain1.se",
						"domain2.se",
					},
					ClTrID: "ABC-1234",
				},
				Template: "domain_check.xml",
			}, {
				Name: "create",
				DefaultData: &DomainCreate{
					Name: "domain1.se",
					Period: &Period{
						Unit: "m",
						Time: 12,
					},
					Hosts: []string{
						"host1.ns",
					},
					Registrant: "contact-1",
					ClTrID:     "ABC-123",
				},
				Template: "domain_create.xml",
			}, {
				Name: "delete",
				DefaultData: &DomainDelete{
					Name:   "domain1.se",
					ClTrID: "ABC-123",
				},
				Template: "domain_delete.xml",
			}, {
				Name: "info",
				DefaultData: &DomainInfo{
					Name:   "domain1.se",
					ClTrID: "ABC-123",
				},
				Template: "domain_info.xml",
			}, {
				Name: "renew",
				DefaultData: &DomainRenew{
					Name:                  "domain1.se",
					CurrentExpirationDate: time.Now().AddDate(0, 1, 0).Format("2006-01-02"),
					ClTrID:                "ABC-123",
				},
				Template: "domain_renew.xml",
			}, {
				Name: "transfer",
				DefaultData: &DomainTransfer{
					Name:     "domain1.se",
					Password: "123456pw!",
					ClTrID:   "ABC-123",
				},
				Template: "domain_transfer.xml",
			}, {
				Name: "update",
				DefaultData: &DomainUpdate{
					Name:   "domain1.se",
					ClTrID: "ABC-123",
				},
				Template: "domain_update.xml",
			},
		},
	},
	{
		Name: "host",
		SubCommand: []*Command{
			{
				Name: "check",
				DefaultData: &HostCheck{
					HostNames: []string{
						"host1.ns",
					},
					ClTrID: "ABC-123",
				},
				Template: "host_check.xml",
			}, {
				Name: "create",
				DefaultData: &HostCreate{
					Name: "host1.ns",
					Addresses: []*HostAddress{{
						IP:      "192.168.1.2",
						Version: "v4",
					}},
					ClTrID: "ABC-123",
				},
				Template: "host_create.xml",
			}, {
				Name: "delete",
				DefaultData: &HostDelete{
					Name:   "host1.ns",
					ClTrID: "ABC-123",
				},
				Template: "host_delete.xml",
			}, {
				Name: "info",
				DefaultData: &HostInfo{
					Name:   "host1.ns",
					ClTrID: "ABC-123",
				},
				Template: "host_info.xml",
			}, {
				Name: "update",
				DefaultData: &HostUpdate{
					Name:   "host1.ns",
					ClTrID: "ABC-123",
				},
				Template: "host_update.xml",
			},
		},
	},
	{
		Name: "login",
		DefaultData: &LoginData{
			Username: "epp100000",
			Password: "apa",
			Namespaces: []string{
				"urn:ietf:params:xml:ns:host-1.0",
				"urn:ietf:params:xml:ns:contact-1.0",
				"urn:ietf:params:xml:ns:domain-1.0",
			},
			ExtensionNamespaces: []string{
				"urn:ietf:params:xml:ns:secDNS-1.0",
				"urn:ietf:params:xml:ns:secDNS-1.1",
				"urn:se:iis:xml:epp:iis-1.2",
				"urn:se:iis:xml:epp:registryLock-1.0",
			},
			Version: "1.0",
			Lang:    "en",
			ClTrID:  "ABC-12345",
		},
		Template: "login.xml",
	},
	{
		Name:     "hello",
		Template: "hello.xml",
	},
	{
		Name:        "logout",
		DefaultData: &LogoutData{ClTrID: "ABC-1234"},
		Template:    "logout.xml",
	},
	{
		Name: "poll",
		DefaultData: &Poll{
			Operation: "ack",
			MessageID: "1",
			ClTrID:    "ABC-123",
		},
		Template: "poll.xml",
	},
}

CommandConfig configuration of default data or the different commands.

Functions

This section is empty.

Types

type Client

type Client struct {
	Greeting  string
	Templates Templates
	// contains filtered or unexported fields
}

Client hold the information needed for the client to get and send messages to and from the server.

func Connect

func Connect(addr string, config *tls.Config) (*Client, error)

Connect connects to the server.

func (*Client) KeepAlive

func (c *Client) KeepAlive(ctx context.Context)

KeepAlive send hello commands to the epp server to keep the connection alive.

func (*Client) SendCommand

func (c *Client) SendCommand(request []byte) (string, error)

SendCommand will write the request given on the server tls connection. Then read the response and return the result.

func (*Client) SendCommandUsingTemplate

func (c *Client) SendCommandUsingTemplate(template string, data any) (string, error)

SendCommandUsingTemplate send a command to the epp server using templates and custom data.

type Command

type Command struct {
	Name        string
	SubCommand  []*Command
	DefaultData any
	Template    string
}

Command holds all information about a command to the server.

type ContactCheck

type ContactCheck struct {
	ContactIDs []string `xml:"id"`
	ClTrID     string   `xml:"clTrID"`
}

ContactCheck the available data for a contact check command.

type ContactCreate

type ContactCreate struct {
	ID                  string        `xml:"id"`
	PostalInfo          []*PostalInfo `xml:"postalInfo"`
	Voice               *VoiceFax     `xml:"voice"`
	Fax                 *VoiceFax     `xml:"fax"`
	Email               string        `xml:"email"`
	Disclose            *Disclose     `xml:"disclose"`
	OrganisationNumber  string        `xml:"orgno"`
	ValueAddedTaxNumber string        `xml:"vatno"`
	ClTrID              string        `xml:"clTrID"`
}

ContactCreate the available data for a contact create command.

type ContactDelete

type ContactDelete struct {
	ID     string `xml:"id"`
	ClTrID string `xml:"clTrID"`
}

ContactDelete the available data for a contact delete command.

type ContactInfo

type ContactInfo struct {
	ID     string `xml:"id"`
	ClTrID string `xml:"clTrID"`
	Pw     string `xml:"pw"`
	ROID   string `xml:"roid"`
}

ContactInfo the available data for a contact info command.

type ContactUpdate

type ContactUpdate struct {
	ID         string        `xml:"id"`
	PostalInfo []*PostalInfo `xml:"postalInfo"`
	Voice      *VoiceFax     `xml:"voice"`
	Fax        *VoiceFax     `xml:"fax"`
	Email      string        `xml:"email"`
	Disclose   *Disclose     `xml:"disclose"`
	ClTrID     string        `xml:"clTrID"`
}

ContactUpdate the available data for a contact update command.

type Disclose

type Disclose struct {
	Disclose          *bool `xml:"disclose"`
	InternationalName bool  `xml:"name:int"`
	LocalName         bool  `xml:"name:loc"`
	InternationalOrg  bool  `xml:"org:int"`
	LocalOrg          bool  `xml:"org:loc"`
	InternationalAddr bool  `xml:"addr:int"`
	LocalAddr         bool  `xml:"addr:loc"`
	Voice             bool  `xml:"voice"`
	Fax               bool  `xml:"fax"`
	Email             bool  `xml:"email"`
}

Disclose hold information about which fields should be disclosed.

type DomainCheck

type DomainCheck struct {
	DomainNames []string `xml:"name"`
	ClTrID      string   `xml:"clTrID"`
}

DomainCheck the available data for a domain check command.

type DomainCreate

type DomainCreate struct {
	Name           string    `xml:"name"`
	Period         *Period   `xml:"period"`
	Hosts          []string  `xml:"hostObj"`
	HostAttributes []string  `xml:"hostName"`
	Password       string    `xml:"pw"`
	Registrant     string    `xml:"registrant"`
	DsData         []*DsData `xml:"dsData"`
	RegistryLock   string    `xml:"unlock"`
	ClTrID         string    `xml:"clTrID"`
}

DomainCreate the available data for a domain create command.

type DomainDelete

type DomainDelete struct {
	Name   string `xml:"name"`
	ClTrID string `xml:"clTrID"`
}

DomainDelete the available data for a domain delete command.

type DomainInfo

type DomainInfo struct {
	Name   string `xml:"name"`
	Hosts  string `xml:"hosts"`
	ClTrID string `xml:"clTrID"`
}

DomainInfo the available data for a domain info command.

type DomainRenew

type DomainRenew struct {
	Name                  string  `xml:"name"`
	CurrentExpirationDate string  `xml:"currExpDate"`
	Period                *Period `xml:"period"`
	ClTrID                string  `xml:"clTrID"`
}

DomainRenew the available data for a domain renew command.

type DomainTransfer

type DomainTransfer struct {
	Name     string   `xml:"name"`
	Password string   `xml:"pw"`
	Hosts    []string `xml:"hostObj"`
	ClTrID   string   `xml:"clTrID"`
}

DomainTransfer the available data for a domain transfer command.

type DomainUpdate

type DomainUpdate struct {
	Name                  string              `xml:"name"`
	Add                   *DomainUpdateAction `xml:"add"`
	Remove                *DomainUpdateAction `xml:"rem"`
	Change                *DomainUpdateChange `xml:"chg"`
	DNSSecAdd             []*DsData           `xml:"secDNS:add"`
	DNSSecRemove          []*DsData           `xml:"secDNS:rem"`
	DNSSecRemoveAll       bool                `xml:"secDNS:rem:all"`
	RegistryLock          string              `xml:"unlock"`
	ClientDelete          *bool               `xml:"clientDelete"`
	ClientDeleteAtExpDate bool                `xml:"clientDelete:atExpDate"`
	ClTrID                string              `xml:"clTrID"`
}

DomainUpdate the available data for a domain update command.

type DomainUpdateAction

type DomainUpdateAction struct {
	Hosts          []string  `xml:"hostObj"`
	HostAttributes []string  `xml:"hostAttr"`
	Statuses       []*Status `xml:"status"`
}

DomainUpdateAction hold information for the domain add and rem elements.

type DomainUpdateChange

type DomainUpdateChange struct {
	Registrant string `xml:"registrant"`
	Password   string `xml:"pw"`
}

DomainUpdateChange hold information for the domain chg element.

type DsData

type DsData struct {
	KeyTag     int    `xml:"keyTag"`
	Algorithm  int    `xml:"alg"`
	DigestType int    `xml:"digestType"`
	Digest     string `xml:"digest"`
}

DsData information for a dnssec element.

type HostAddress

type HostAddress struct {
	IP      string `xml:"addr"`
	Version string `xml:"version"`
}

HostAddress hold information about the host address element.

type HostCheck

type HostCheck struct {
	HostNames []string `xml:"name"`
	ClTrID    string   `xml:"clTrID"`
}

HostCheck the available data for a host check command.

type HostCreate

type HostCreate struct {
	Name      string         `xml:"name"`
	Addresses []*HostAddress `xml:"addr"`
	ClTrID    string         `xml:"clTrID"`
}

HostCreate the available data for a host create command.

type HostDelete

type HostDelete struct {
	Name   string `xml:"name"`
	ClTrID string `xml:"clTrID"`
}

HostDelete the available data for a host delete command.

type HostInfo

type HostInfo struct {
	Name   string `xml:"name"`
	ClTrID string `xml:"clTrID"`
}

HostInfo the available data for a host info command.

type HostUpdate

type HostUpdate struct {
	Name            string         `xml:"name"`
	AddAddresses    []*HostAddress `xml:"add"`
	RemoveAddresses []*HostAddress `xml:"rem"`
	ChangeAddresses []*HostAddress `xml:"chg"`
	ClTrID          string         `xml:"clTrID"`
}

HostUpdate the available data for a host update command.

type IPAddress

type IPAddress struct {
	Name    string `xml:"name"`
	Address string `xml:"ip"`
}

IPAddress the needed information about an IP address.

type LoginData

type LoginData struct {
	Username            string   `xml:"clID"`
	Password            string   `xml:"pw"`
	Namespaces          []string `xml:"objURI"`
	ExtensionNamespaces []string `xml:"extURI"`
	Version             string   `xml:"version"`
	Lang                string   `xml:"lang"`
	ClTrID              string   `xml:"clTrID"`
}

LoginData the available data for a login command.

type LogoutData

type LogoutData struct {
	ClTrID string `xml:"clTrID"`
}

LogoutData the available data for a logout command.

type Period

type Period struct {
	Unit string `xml:"unit"`
	Time int    `xml:"period"`
}

Period the data needed for a period element.

type Poll

type Poll struct {
	Operation string `xml:"op"`
	MessageID string `xml:"msgID"`
	ClTrID    string `xml:"clTrID"`
}

Poll the available data for a poll command.

type PostalAddress

type PostalAddress struct {
	Street          []string `xml:"street"`
	City            string   `xml:"city"`
	StateOrProvince string   `xml:"sp"`
	PostalCode      string   `xml:"pc"`
	CountryCode     string   `xml:"cc"`
}

PostalAddress hold information for the addr element.

type PostalInfo

type PostalInfo struct {
	Location     string         `xml:"loc"`
	Name         string         `xml:"name"`
	Organization string         `xml:"org"`
	Address      *PostalAddress `xml:"addr"`
}

PostalInfo hold information for the postalInfo element.

type Status

type Status struct {
	Status   string `xml:"s"`
	Language string `xml:"lang"`
	Message  string `xml:"message"`
}

Status hold information for the status element.

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

Templates hold the templates and template functions.

func (*Templates) Execute

func (t *Templates) Execute(w io.Writer, name string, data any) error

Execute the given template using the given data.

type VoiceFax

type VoiceFax struct {
	X      string `xml:"x"`
	Number string `xml:"number"`
}

VoiceFax hold data for the voice and fax elements.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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