Documentation ¶
Index ¶
- Constants
- Variables
- type DbusClientSerivce
- func (c *DbusClientSerivce) AddForwardPort(zone string, timeout uint32, forward *api2.ForwardPort) error
- func (c *DbusClientSerivce) AddNewService(name string, setting *api2.ServiceSetting) error
- func (c *DbusClientSerivce) AddPermanentForwardPort(zone string, forward *api2.ForwardPort) error
- func (c *DbusClientSerivce) AddPermanentRichRule(zone string, rule *api2.Rule) error
- func (c *DbusClientSerivce) AddPermanentService(zone, service string) error
- func (c *DbusClientSerivce) AddPort(port *api2.Port, zone string, timeout uint32) error
- func (c *DbusClientSerivce) AddProtocol(zone, protocol string, timeout uint32) error
- func (c *DbusClientSerivce) AddRichRule(zone string, rule *api2.Rule, timeout uint32) error
- func (c *DbusClientSerivce) AddServiceRuntime(zone, service string, timeout uint32) error
- func (c *DbusClientSerivce) AddZone(setting *api2.Settings) error
- func (c *DbusClientSerivce) BindInterface(zone, interfaceName string) (string, error)
- func (c *DbusClientSerivce) BindPermanentInterface(zone, interfaceName string) (err error)
- func (c *DbusClientSerivce) Destroy()
- func (c *DbusClientSerivce) DisableMasquerade(zone string) (err error)
- func (c *DbusClientSerivce) DisablePermanentMasquerade(zone string) (err error)
- func (c *DbusClientSerivce) EnableMasquerade(zone string, timeout uint32) error
- func (c *DbusClientSerivce) EnablePermanentMasquerade(zone string) error
- func (c *DbusClientSerivce) GetDefaultPolicy() string
- func (c *DbusClientSerivce) GetDefaultZone() string
- func (c *DbusClientSerivce) GetPermanentRichRules(zone string) (ruleList []*api2.Rule, err error)
- func (c *DbusClientSerivce) GetPermanentServices() (list []string, err error)
- func (c *DbusClientSerivce) GetPorts(zone string) (relits []api2.Port, enconterError error)
- func (c *DbusClientSerivce) GetRichRules(zone string) (ruleList []*api2.Rule, err error)
- func (c *DbusClientSerivce) GetRuntimeServices(zone string) (list []string, err error)
- func (c *DbusClientSerivce) GetZoneOfInterface(iface string) string
- func (c *DbusClientSerivce) GetZoneSettings(zone string) error
- func (c *DbusClientSerivce) GetZones() ([]string, error)
- func (c *DbusClientSerivce) ListServices() (list []string, err error)
- func (c *DbusClientSerivce) Listforwards(zone string) ([]api2.ForwardPort, error)
- func (c *DbusClientSerivce) PermanentAddPort(port string, zone string) (enconterError error)
- func (c *DbusClientSerivce) PermanentGetForwardPort(zone string) ([]api2.ForwardPort, error)
- func (c *DbusClientSerivce) PermanentGetPort(zone string) (list []api2.Port, enconterError error)
- func (c *DbusClientSerivce) PermanentQueryForwardPort(zone, portProtocol, toHostPort string) (b bool)
- func (c *DbusClientSerivce) PermanentQueryService(zone, service string) bool
- func (c *DbusClientSerivce) PermanentRemoveInterface(zone, interfaceName string) error
- func (c *DbusClientSerivce) PermanentRemovePort(port, zone string) (enconterError error)
- func (c *DbusClientSerivce) QueryForwardPort(zone, portProtocol, toHostPort string) bool
- func (c *DbusClientSerivce) QueryInterface(zone, interfaceName string) bool
- func (c *DbusClientSerivce) QueryMasquerade(zone string) (b bool, err error)
- func (c *DbusClientSerivce) QueryPermanentInterface(zone, interfaceName string) error
- func (c *DbusClientSerivce) QueryPermanentMasquerade(zone string) (bool, error)
- func (c *DbusClientSerivce) QueryPermanentRichRule(zone string, rule *api2.Rule) bool
- func (c *DbusClientSerivce) QueryRichRule(zone string, rule *api2.Rule) bool
- func (c *DbusClientSerivce) QueryService(zone, service string) bool
- func (c *DbusClientSerivce) Reload() error
- func (c *DbusClientSerivce) RemoveForwardPort(zone string, forward *api2.ForwardPort) error
- func (c *DbusClientSerivce) RemoveInterface(zone, interfaceName string) error
- func (c *DbusClientSerivce) RemovePermanentForwardPort(zone string, forward *api2.ForwardPort) error
- func (c *DbusClientSerivce) RemovePermanentRichRule(zone string, rule *api2.Rule) error
- func (c *DbusClientSerivce) RemovePermanentService(service string) error
- func (c *DbusClientSerivce) RemovePort(port *api2.Port, zone string) error
- func (c *DbusClientSerivce) RemoveRichRule(zone string, rule *api2.Rule) error
- func (c *DbusClientSerivce) RemoveRuntimeService(zone, service string) error
- func (c *DbusClientSerivce) RemoveZone(zone string) error
- func (c *DbusClientSerivce) RuntimeFlush(zone string) (encounterError error)
- func (c *DbusClientSerivce) SetDefaultZone(zone string) (err error)
Constants ¶
const ( CallRemoteFormat = "Call %s D-Bus: %s" NotFount = "Resource %s not fount" PermanentNotFount = "Permament resource %s not fount" // create CreateResourceStartFormat = "Trying to create %s on %s: %v" CreateResourceSuccessFormat = "Create %s on %s successed, %v" CreateResourceFailedFormat = "Create %s on %s failed: %v" CreatePermanentResourceStartFormat = "Trying to create permanent %s on %s: %v" CreatePermanentResourceSuccessFormat = "Create permanent %s on %s successed, %v" CreatePermanentResourceFailedFormat = "Create permanent %s on %s failed: %v" // query QueryResourceStartFormat = "Trying to query %s on %s: %v" QueryResourceSuccessFormat = "Query %s on %s: %v" QueryResourceFailedFormat = "Query %s on %s failed: %v" QueryPermanentResourceStartFormat = "Trying to query permanent %s on %s: %v" QueryPermanentResourceSuccessFormat = "Query permanent %s on %s: %v" QueryPermanentResourceFailedFormat = "Query permanent %s on %s failed: %v" QueryNotFount = "Resource %s not fount" // list ListResourceStartFormat = "Trying list available %s on %s" ListResourceSuccessFormat = "List of %s on %s: %v" ListResourceFailedFormat = "List available %s on %s failed: %v" ListPermanentResourceStartFormat = "Trying list permanent %s on %s" ListPermanentResourceSuccessFormat = "List permanent %s on %s: %v" ListPermanentResourceFailedFormat = "List permanent %s on %s failed: %v" // delete RemoveResourceStartFormat = "Trying remove %s on %s: %v" RemoveResourceSuccessFormat = "Remove %s on %s successed: %v" RemoveResourceFailedFormat = "Remove %s on %s failed: %v" RemovePermanentResourceStartFormat = "Trying remove permanent %s on %s: %v" RemovePermanentResourceSuccessFormat = "Remove permanent %s on %s successed: %v" RemovePermanentResourceFailedFormat = "Remove permanent %s on %s failed: %v" // switch SwitchResourceStartFormat = "Trying %s masquerade on %s" SwitchPermanentResourceStartFormat = "Trying permament %s masquerade on %s" SwitchResourceSuccessFormat = "Operation %v masquerade on %s successed" SwitchPermanentResourceSuccessFormat = "Operation %v permanent masquerade on %s successed" SwitchResourceFailedFormat = "Operation %v masquerade on %s failed: %v" SwitchPermanentResourceFailedFormat = "Operation %v permanent masquerade on %s failed: %v" // zone ZoneDefaultStartFormat = "Trying set default zone on %s to %s " ZoneDefaultSuccessFormat = "Set default zone on %s to %s successed" ZoneDefaultFailedFormat = "Set default zone on %s to %s failed: %v" )
Variables ¶
var ( PORT = "55556" InterfaceName = "com.github.cylonchau." )
Functions ¶
This section is empty.
Types ¶
type DbusClientSerivce ¶
type DbusClientSerivce struct {
// contains filtered or unexported fields
}
func NewDbusClientService ¶
func NewDbusClientService(addr string) (*DbusClientSerivce, error)
func (*DbusClientSerivce) AddForwardPort ¶
func (c *DbusClientSerivce) AddForwardPort(zone string, timeout uint32, forward *api2.ForwardPort) error
* @title AddForwardPort * @description temporary Add the IPv4 forward port into zone. * @middlewares author 2021-09-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @param timeout int "Timeout, if timeout is non-zero, the operation will be active only for the amount of seconds." * @return error error "Possible errors: * INVALID_ZONE, * INVALID_PORT, * MISSING_PROTOCOL, * INVALID_PROTOCOL, * INVALID_ADDR, * INVALID_FORWARD, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) AddNewService ¶
func (c *DbusClientSerivce) AddNewService(name string, setting *api2.ServiceSetting) error
:title NewService :description in runtime configuration. :Create author 2021-10-23 :Update author 2024-09-06 :param service string "service name." :param setting *ServiceSetting "service configruate" :return error error "Possible errors:
NAME_CONFLICT, INVALID_NAME, INVALID_TYPE"
func (*DbusClientSerivce) AddPermanentForwardPort ¶
func (c *DbusClientSerivce) AddPermanentForwardPort(zone string, forward *api2.ForwardPort) error
* @title PermanentAddForwardPort * @description temporary Add the IPv4 forward port into zone. * @middlewares author 2021-10-07 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) AddPermanentRichRule ¶
func (c *DbusClientSerivce) AddPermanentRichRule(zone string, rule *api2.Rule) error
func (*DbusClientSerivce) AddPermanentService ¶ added in v0.0.7
func (c *DbusClientSerivce) AddPermanentService(zone, service string) error
:title AddPermanentService :description Permanently add service to list of services used in zone. :Create author 2021-09-29 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) AddProtocol ¶
func (c *DbusClientSerivce) AddProtocol(zone, protocol string, timeout uint32) error
:title AddProtocol :description temporary get a firewalld port list :middlewares author 2021-09-29 :param zone string "e.g. public|dmz.. If zone is empty string, use default zone. " :param protocol string "e.g. tcp|udp... The protocol can be any protocol supported by the system." :param timeout int "Timeout, if timeout is non-zero, the operation will be active only for the amount of seconds." :return zoneName string "Returns name of zone to which the protocol was added." :return error error "Possible errors: INVALID_ZONE, INVALID_PROTOCOL, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) AddRichRule ¶
func (*DbusClientSerivce) AddServiceRuntime ¶ added in v0.0.7
func (c *DbusClientSerivce) AddServiceRuntime(zone, service string, timeout uint32) error
:title AddServiceRuntime :description Add service into zone (runtime). :Create author 2021-09-29 :Update author 2024-09-07 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :param timeout int "Timeout, if timeout is non-zero, the operation will be active only for the amount of seconds." :return zoneName string "Returns name of zone to which the service was added." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) AddZone ¶
func (c *DbusClientSerivce) AddZone(setting *api2.Settings) error
###title AddZone ###description Add zone with given settings into permanent configuration. ###middlewares author 2021-09-27 ###param name string "Is an optional start and end tag and is used to give a more readable name." ###return error error "Possible errors: NAME_CONFLICT, INVALID_NAME, INVALID_TYPE"
func (*DbusClientSerivce) BindInterface ¶
func (c *DbusClientSerivce) BindInterface(zone, interfaceName string) (string, error)
* @title BindInterface * @description temporary Bind interface with zone. From now on all traffic * going through the interface will respect the zone's settings. * @middlewares author 2021-09-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return zoneName string "Returns name of zone to which the interface was bound." * @return error error "Possible errors: * INVALID_ZONE, * INVALID_INTERFACE, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) BindPermanentInterface ¶
func (c *DbusClientSerivce) BindPermanentInterface(zone, interfaceName string) (err error)
* @title PermanentBindInterface * @description Permanently Bind interface with zone. From now on all traffic * going through the interface will respect the zone's settings. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) Destroy ¶
func (c *DbusClientSerivce) Destroy()
* @title Destroy * @description off firewalld connection. * @middlewares author 2021-10-31
func (*DbusClientSerivce) DisableMasquerade ¶
func (c *DbusClientSerivce) DisableMasquerade(zone string) (err error)
* @title DisableMasquerade * @description temporary enable masquerade in zone.. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param timeout int "Timeout, If timeout is non-zero, masquerading will be active for the amount of seconds." * @return zoneName string "Returns name of zone in which the masquerade was enabled." * @return error error "Possible errors: * INVALID_ZONE, * NOT_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) DisablePermanentMasquerade ¶
func (c *DbusClientSerivce) DisablePermanentMasquerade(zone string) (err error)
* @title PermanentDisableMasquerade * @description permanent enable masquerade in zone.. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return b bool "Possible errors: * @return error error "Possible errors: * NOT_ENABLED"
func (*DbusClientSerivce) EnableMasquerade ¶
func (c *DbusClientSerivce) EnableMasquerade(zone string, timeout uint32) error
* @title EnableMasquerade * @description temporary enable masquerade in zone.. * @middlewares author 2021-09-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param timeout int "Timeout, If timeout is non-zero, masquerading will be active for the amount of seconds." * @return error error "Possible errors: * INVALID_ZONE, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) EnablePermanentMasquerade ¶
func (c *DbusClientSerivce) EnablePermanentMasquerade(zone string) error
* @title PermanentEnableMasquerade * @description permanent enable masquerade in zone.. * @middlewares author 2021-09-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return error error "Possible errors: * INVALID_ZONE, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) GetDefaultPolicy ¶ added in v0.0.3
func (c *DbusClientSerivce) GetDefaultPolicy() string
###title GetZoneOfInterface ###description temporary add a firewalld port ###middlewares author 2023-04-22 ###param iface string "e.g. eth0, iface is device name." ###return zoneName string "Return name (s) of zone the interface is bound to or empty string.."
func (*DbusClientSerivce) GetDefaultZone ¶
func (c *DbusClientSerivce) GetDefaultZone() string
func (*DbusClientSerivce) GetPermanentRichRules ¶ added in v0.0.6
func (c *DbusClientSerivce) GetPermanentRichRules(zone string) (ruleList []*api2.Rule, err error)
func (*DbusClientSerivce) GetPermanentServices ¶
func (c *DbusClientSerivce) GetPermanentServices() (list []string, err error)
:title PermanentGetServices :description Get list of service names used in zone (permanent). :Create author 2021-10-21 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) GetPorts ¶ added in v0.0.3
func (c *DbusClientSerivce) GetPorts(zone string) (relits []api2.Port, enconterError error)
GetPort :description temporary get a firewalld port list :Create author 2021-09-29 :Update author 2024-09-06 :param zone string "The empty string is usage default zone, is currently firewalld defualt zone." - e.g. public|dmz.. :return []list Port "Returns port list of zone." :return error error "Possible errors:
- INVALID_ZONE"
func (*DbusClientSerivce) GetRichRules ¶
func (c *DbusClientSerivce) GetRichRules(zone string) (ruleList []*api2.Rule, err error)
func (*DbusClientSerivce) GetRuntimeServices ¶ added in v0.0.7
func (c *DbusClientSerivce) GetRuntimeServices(zone string) (list []string, err error)
:title GetRuntimeServices :description Get list of service names used in zone (runtime). :Create author 2024-09-07 :Update author 2024-09-07 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) GetZoneOfInterface ¶
func (c *DbusClientSerivce) GetZoneOfInterface(iface string) string
###title GetZoneOfInterface ###description temporary add a firewalld port ###middlewares author 2021-09-27 ###param iface string "e.g. eth0, iface is device name." ###return zoneName string "Return name (s) of zone the interface is bound to or empty string.."
func (*DbusClientSerivce) GetZoneSettings ¶
func (c *DbusClientSerivce) GetZoneSettings(zone string) error
###title GetZoneSettings ###description Return runtime settings of given zone. ###middlewares author 2021-09-26 ###param zone string "zone name." ###return error error "Possible errors: INVALID_ZONE"
func (*DbusClientSerivce) GetZones ¶
func (c *DbusClientSerivce) GetZones() ([]string, error)
###title GetZones ###description Return runtime settings of given zone. ###middlewares author 2021-09-26 ###return zones []string "Return array of names (s) of predefined zones known to current runtime environment." ###return error error ""
func (*DbusClientSerivce) ListServices ¶ added in v0.0.7
func (c *DbusClientSerivce) ListServices() (list []string, err error)
:title ListServices :description Return array of avliable of services in permanent configuration. :Create author 2021-10-23 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :param timeout int "Timeout, if timeout is non-zero, the operation will be active only for the amount of seconds." :return zoneName string "Returns name of zone to which the service was added." :return error error "Possible errors:
INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) Listforwards ¶
func (c *DbusClientSerivce) Listforwards(zone string) ([]api2.ForwardPort, error)
* @title GetForwardPort * @description temporary get IPv4 forward port in zone. * @middlewares author 2021-10-27 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return forwardPort set "Return array of IPv4 forward ports previously added into zone. * @return error error "Possible errors: * INVALID_ZONE
func (*DbusClientSerivce) PermanentAddPort ¶
func (c *DbusClientSerivce) PermanentAddPort(port string, zone string) (enconterError error)
PermanentAddPort :description Permanently add port & procotol to list of ports of zone. :Create author 2021-09-29 :Update author 2024-09-06 :param port string "e.g. 80/tcp, 1000-1100/tcp, 80, 1000-1100 default protocol tcp" :param zone string "e.g. public|dmz.. The empty string is usage default zone, is currently firewalld defualt zone" :return error error "Possible errors: ALREADY_ENABLED."
func (*DbusClientSerivce) PermanentGetForwardPort ¶
func (c *DbusClientSerivce) PermanentGetForwardPort(zone string) ([]api2.ForwardPort, error)
* @title PermanentGetForwardPort * @description permanent get IPv4 forward port in zone. * @middlewares author 2021-10-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return forwardPort set "Return array of IPv4 forward ports previously added into zone. * @return error error "Possible errors: * INVALID_ZONE
func (*DbusClientSerivce) PermanentGetPort ¶
func (c *DbusClientSerivce) PermanentGetPort(zone string) (list []api2.Port, enconterError error)
PermanentGetPort :description get Permanent configurtion a firewalld port list. :Create author 2021-09-29 :Update author 2024-09-06 :param zone string "The empty string is usage default zone, is currently firewalld defualt zone" - e.g. public|dmz.. :return []list Port "Returns port list of zone." :return error error "Possible errors:"
- INVALID_ZONE
func (*DbusClientSerivce) PermanentQueryForwardPort ¶
func (c *DbusClientSerivce) PermanentQueryForwardPort(zone, portProtocol, toHostPort string) (b bool)
* @title PermanentQueryForwardPort * @description Permanently remove (port, protocol, toport, toaddr) from list of forward ports of zone. * @middlewares author 2021-10-07 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) PermanentQueryService ¶
func (c *DbusClientSerivce) PermanentQueryService(zone, service string) bool
:title PermanentQueryService :description Permanent Return whether Add service in rich rules in zone. :Create author 2021-10-05 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) PermanentRemoveInterface ¶
func (c *DbusClientSerivce) PermanentRemoveInterface(zone, interfaceName string) error
* @title PermanentRemoveInterface * @description Permanently remove interface from list of interfaces bound to zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param interfaceName string "interface name. e.g. eth0 | ens33. " * @return error error "Possible errors: * NOT_ENABLED"
func (*DbusClientSerivce) PermanentRemovePort ¶
func (c *DbusClientSerivce) PermanentRemovePort(port, zone string) (enconterError error)
PermanentRemovePort :description Permanently delete (port, protocol) from list of ports of zone. :Create author 2021-09-29 :Update author 2024-09-06 :param port string "e.g. 80/tcp, 1000-1100/tcp, 80, 1000-1100 default protocol tcp" :param zone string "The empty string is usage default zone, is currently firewalld defualt zone" - e.g. public|dmz.." :return bool string "Returns name of zone from which the port was removed." :return error error "Possible errors:
- NOT_ENABLED"
func (*DbusClientSerivce) QueryForwardPort ¶
func (c *DbusClientSerivce) QueryForwardPort(zone, portProtocol, toHostPort string) bool
* @title QueryForwardPort * @description temporary (runtime) query whether the IPv4 forward port (port, protocol, toport, toaddr) has been added into zone. * @middlewares author 2021-10-07 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @return error error "Possible errors: * INVALID_ZONE, * INVALID_PORT, * MISSING_PROTOCOL, * INVALID_PROTOCOL, * INVALID_ADDR, * INVALID_FORWARD, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) QueryInterface ¶
func (c *DbusClientSerivce) QueryInterface(zone, interfaceName string) bool
* @title QueryInterface * @description temporary Query whether interface has been bound to zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param interface string "device name, e.g. " * @return b bool "true:enable, fales:disable." * @return error error "Possible errors: * INVALID_ZONE, * INVALID_INTERFACE
func (*DbusClientSerivce) QueryMasquerade ¶
func (c *DbusClientSerivce) QueryMasquerade(zone string) (b bool, err error)
* @title QueryMasquerade * @description query runtime masquerading has been enabled in zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param timeout int "Timeout, If timeout is non-zero, masquerading will be active for the amount of seconds." * @return zoneName string "Returns name of zone in which the masquerade was enabled." * @return error error "Possible errors: * INVALID_ZONE"
func (*DbusClientSerivce) QueryPermanentInterface ¶
func (c *DbusClientSerivce) QueryPermanentInterface(zone, interfaceName string) error
* @title PermanentQueryInterface * @description Permanently Query whether interface has been bound to zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) QueryPermanentMasquerade ¶
func (c *DbusClientSerivce) QueryPermanentMasquerade(zone string) (bool, error)
* @title PermanentQueryMasquerade * @description query runtime masquerading has been enabled in zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return b bool "enable: true, disable:false: * @return error error "Possible errors: * INVALID_ZONE"
func (*DbusClientSerivce) QueryPermanentRichRule ¶
func (c *DbusClientSerivce) QueryPermanentRichRule(zone string, rule *api2.Rule) bool
func (*DbusClientSerivce) QueryRichRule ¶
func (c *DbusClientSerivce) QueryRichRule(zone string, rule *api2.Rule) bool
func (*DbusClientSerivce) QueryService ¶
func (c *DbusClientSerivce) QueryService(zone, service string) bool
:title QueryService :description temporary check whether service has been added for zone.. :Create author 2021-10-05 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) Reload ¶
func (c *DbusClientSerivce) Reload() error
@title Reload @description reload firewalld on runtime @middlewares author 2024-08-07 @return error error "Possible errors:
ALREADY_ENABLED"
func (*DbusClientSerivce) RemoveForwardPort ¶
func (c *DbusClientSerivce) RemoveForwardPort(zone string, forward *api2.ForwardPort) error
* @title RemoveForwardPort * @description temporary (runtime) Remove IPv4 forward port ((port, protocol, toport, toaddr)) from zone. * @middlewares author 2021-09-29 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @return error error "Possible errors: * INVALID_ZONE, * INVALID_PORT, * MISSING_PROTOCOL, * INVALID_PROTOCOL, * INVALID_ADDR, * INVALID_FORWARD, * ALREADY_ENABLED, * INVALID_COMMAND"
func (*DbusClientSerivce) RemoveInterface ¶
func (c *DbusClientSerivce) RemoveInterface(zone, interfaceName string) error
* @title RemoveInterface * @description Permanently Query whether interface has been bound to zone. * @middlewares author 2021-10-05 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) RemovePermanentForwardPort ¶
func (c *DbusClientSerivce) RemovePermanentForwardPort(zone string, forward *api2.ForwardPort) error
* @title PermanentRemoveForwardPort * @description Permanently remove (port, protocol, toport, toaddr) from list of forward ports of zone. * @middlewares author 2021-10-07 * @param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " * @param portProtocol string "The port can either be a single port number portid or a port * range portid-portid. The protocol can either be tcp or udp e.g. 10-20/tcp|20|20/tcp" * @param toHostPort string "The destination address is a simple IP address. e.g. 10.0.0.1:22" * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) RemovePermanentRichRule ¶
func (c *DbusClientSerivce) RemovePermanentRichRule(zone string, rule *api2.Rule) error
func (*DbusClientSerivce) RemovePermanentService ¶
func (c *DbusClientSerivce) RemovePermanentService(service string) error
:title Permanently remove service from list of services used in zone. :description PPermanently remove service from list of services used in zone. :Create author 2021-09-29 :Update author 2024-09-06 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) RemovePort ¶
func (c *DbusClientSerivce) RemovePort(port *api2.Port, zone string) error
RemovePort :description temporary delete a firewalld port :Create author 2021-09-29 :Update author 2024-09-06 :param port string "e.g. 80/tcp, 1000-1100/tcp, 80, 1000-1100 default protocol tcp" :param zone string "e.g. public|dmz.. The empty string is usage default zone, is currently firewalld defualt zone" :return bool string "Returns name of zone from which the port was removed." :return error error "Possible errors:
- INVALID_ZONE,
- INVALID_PORT,
- MISSING_PROTOCOL,
- INVALID_PROTOCOL,
- NOT_ENABLED,
- INVALID_COMMAND"
swagger: ignore
func (*DbusClientSerivce) RemoveRichRule ¶
func (c *DbusClientSerivce) RemoveRichRule(zone string, rule *api2.Rule) error
func (*DbusClientSerivce) RemoveRuntimeService ¶ added in v0.0.7
func (c *DbusClientSerivce) RemoveRuntimeService(zone, service string) error
:title RemoveService :description Remove service from zone (runtime). :Create author 2021-10-05 :Update author 2024-09-07 :param zone string "If zone is empty string, use default zone. e.g. public|dmz.. " :param service string "service name e.g. http|ssh|ftp.." :return error error "Possible errors: INVALID_ZONE, INVALID_SERVICE, ALREADY_ENABLED, INVALID_COMMAND"
func (*DbusClientSerivce) RemoveZone ¶
func (c *DbusClientSerivce) RemoveZone(zone string) error
###title RemoveZone ###description Return runtime settings of given zone. ###middlewares author 2021-09-26 ###param zone string "zone name." ###return error error "Possible errors: INVALID_ZONE"
func (*DbusClientSerivce) RuntimeFlush ¶
func (c *DbusClientSerivce) RuntimeFlush(zone string) (encounterError error)
* @title flush currently zone zoneSettings to default zoneSettings. * @description temporary Add rich language rule into zone. * @middlewares author 2021-10-05 * @return error error "Possible errors: * ALREADY_ENABLED"
func (*DbusClientSerivce) SetDefaultZone ¶
func (c *DbusClientSerivce) SetDefaultZone(zone string) (err error)
title SetDefaultZone description Set default zone for connections and interfaces where no zone has been selected to zone. This is a runtime and permanent change. middlewares author cylon 2021-09-26 param zone zone name return error error ""