Documentation ¶
Index ¶
- Constants
- func UniqueSortedInts(in []int) (out []int)
- type FirewalldPort
- type FirewalldService
- type HANAGlobalParameters
- func (global *HANAGlobalParameters) GetPortNumbers(portDefinition string) (ret []int, err error)
- func (global *HANAGlobalParameters) MakeFirewalldService(def *HANAServiceDefinition) (serviceShortName string, svc FirewalldService, err error)
- func (global *HANAGlobalParameters) ReadFrom(txt *txtparser.Sysconfig)
- func (global *HANAGlobalParameters) WriteInto(txt *txtparser.Sysconfig)
- type HANAServiceDefinition
Constants ¶
const ( FirewalldProtocolTCP = "tcp" FirewalldProtocolUDP = "udp" )
const ( /* InstanceNumberSubstitutionMagic is a substring that appears among HANA networks service port definitions. The substring serves as a placeholder, the actual port number will be calculated by substituting the placeholder by a HANA instance number. For example, given a port definition of "1__INST_NUM__2" and an instance number of 00, the calculated port number will be "1002". */ InstanceNumberSubstitutionMagic = "__INST_NUM__" /* InstanceNumberPlusOneSubstitutionMagic is a substring that appears among HANA networks service port definitions. Similar to InstanceNumberSubstitutionMagic, this placeholder will be substituted by instance number plus one. */ InstanceNumberPlusOneSubstitutionMagic = "__INST_NUM+1__" HANAServiceDefinitionTCPKey = "TCP" HANAServiceDefinitionUDPKey = "UDP" HANAGlobalInstanceNumbersKey = "HANA_INSTANCE_NUMBERS" )
Variables ¶
This section is empty.
Functions ¶
func UniqueSortedInts ¶
UniqueSortedInts returns unique integers among the input, sorted in ascending order.
Types ¶
type FirewalldPort ¶
FirewalldPort defines a port to be opened in a service.
type FirewalldService ¶
type FirewalldService struct { ShortName string `xml:"short"` Description string `xml:"description"` Ports []FirewalldPort `xml:"port"` }
FirewalldService defines a service with its name, description, and ports.
func (*FirewalldService) String ¶
func (svc *FirewalldService) String() string
String returns firewall service details in an easy to read, indented format.
func (*FirewalldService) ToXML ¶
func (svc *FirewalldService) ToXML() string
ToXML serialised service definition into a complete XML document that includes the XML header.
type HANAGlobalParameters ¶
type HANAGlobalParameters struct {
InstanceNumbers []string
}
HANAGlobalParameters are settings that come from /etc/sysconfig/hana-firewall.
func (*HANAGlobalParameters) GetPortNumbers ¶
func (global *HANAGlobalParameters) GetPortNumbers(portDefinition string) (ret []int, err error)
GetPortNumbers returns actual service port numbers calculated by expanding definition string with instance number parameter. An error will be returned only if there is a number formatting.
func (*HANAGlobalParameters) MakeFirewalldService ¶
func (global *HANAGlobalParameters) MakeFirewalldService(def *HANAServiceDefinition) (serviceShortName string, svc FirewalldService, err error)
MakeFirewalldService generates firewalld service definition for a single HANA service definition.
func (*HANAGlobalParameters) ReadFrom ¶
func (global *HANAGlobalParameters) ReadFrom(txt *txtparser.Sysconfig)
func (*HANAGlobalParameters) WriteInto ¶
func (global *HANAGlobalParameters) WriteInto(txt *txtparser.Sysconfig)
type HANAServiceDefinition ¶
type HANAServiceDefinition struct { FileBaseName string // FileBaseName is the base name of service definition file. TCP []string // TCP port numbers, each one may include the instance number substitution magic. UDP []string // UDP port numbers, each one may include the instance number substitution magic. }
HANAServiceDefinition is a HANA network service definition written in a sysconfig-style text file.
func (*HANAServiceDefinition) GetShortName ¶
func (def *HANAServiceDefinition) GetShortName() string
GetShortName returns a linted "short name" that identifies a Firewalld service and its XML file.
func (*HANAServiceDefinition) ReadFrom ¶
func (def *HANAServiceDefinition) ReadFrom(txt *txtparser.Sysconfig)
ReadFromText reads definition content from a sysconfig-style text file.
func (*HANAServiceDefinition) WriteInto ¶
func (def *HANAServiceDefinition) WriteInto(txt *txtparser.Sysconfig)
WriteInto overwrites keys and values of text file with the current definition content.