cgpcli

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

README

cgpcli

cgpcli is a Go client library for the CommuniGate Pro CLI. It provides a reliable bridge between CGP's unique syntax and native Go types with a focus on efficiency and correct type mapping.

Installation

go get git.vsu.ru/ai/cgpcli

Usage

package main

import (
	"git.vsu.ru/ai/cgpcli"
)

func main() {
	cli, err := cgpcli.New("mail.example.com", "admin", "password", cgpcli.Plain, false)
	if err != nil {
		panic(err)
	}
	defer cli.Close()

	settings, err := cli.GetAccountSettings("user@example.com")
	if err != nil {
		panic(err)
	}

	cgpcli.PrettyPrint(settings)
}

Data Representation: map[string]any

The library uses map[string]any as the primary container for CGP data structures.

  • Dynamic Schema: CommuniGate Pro responses (e.g., GetAccountSettings) often contain hundreds of keys that vary between versions. Maps provide the flexibility to handle this without maintaining large, fragile struct definitions.
  • Smart Typing: The library performs type conversion following the CGP documentation:
    • Standard Types: Automatic conversion for integers, booleans, arrays, and dictionaries.
    • Specialized Types: Values like Created dates, sizes (10K, 5M), durations (10m, never), and IP addresses are automatically converted to native Go types (time.Time, int64, time.Duration, net.IP).
    • Legacy & Exceptions: Correct handling of legacy formats and special CGP values through an internal registry.

Application Architecture

For production applications, it is recommended to write thin wrappers over the library's maps. Since a typical application only needs a fraction of the available keys, this approach ensures strict typing and clean code without the overhead of maintaining comprehensive struct definitions.

Debugging

The library provides two levels of debugging to simplify development and troubleshooting:

  • Type Inspection: The PrettyPrint function prints the structure of returned data to stdout. It highlights the Go types assigned to each value, clearly showing how the parser interpreted the CGP data.
  • Protocol Logging: By calling cli.SetDebug(true), you can enable raw protocol logging to stderr. This allows you to see the exact strings being exchanged with the CommuniGate Pro CLI, which is essential for diagnosing low-level communication issues.

Performance and Design

The marshaling engine avoids unnecessary heap allocations. The library avoids use of reflection and the fmt package in hot paths.

License

This project is licensed under the BSD 3-Clause License.

Author

Andrey Igoshin ai@vsu.ru

Documentation

Overview

Account Administration

The Accounts section provides comprehensive methods for managing CommuniGate Pro accounts across their entire lifecycle. It supports core administrative tasks such as creation, deletion, and renaming, as well as fine-grained configuration of Settings (admin-level limits) and Preferences (user-level options).

Key capabilities include:

  • Password management and identity verification.
  • Full support for Mail and Signal Rules.
  • Access control via ACLs and Rights management.
  • Alias and Telephony number (Telnums) configuration.

Alert Administration

The Alerts section provides functionality for managing system and user notifications across all administrative levels: Server, Cluster, Domain, and Account.

Key capabilities include:

  • Retrieving active alerts using "GET...ALERTS" commands.
  • Posting new custom alerts for administrators or users to see.
  • Removing specific alerts using their unique timestamps.
  • Batch updating alert dictionaries.

CLI Access

The CLI Access section implements the core transport and session management for CommuniGate Pro. It handles the low-level communication protocol, ensuring reliable and secure data exchange between the Go application and the CommuniGate Pro CLI.

Key capabilities include:

  • Session Lifecycle: automatic connection establishment, authentication, and graceful termination via Cli.Close.
  • Persistence: transparent re-connection logic if the session exceeds the server's idle timeout (approx. 5 minutes).
  • Security: support for standard Plain login, MD5-based APOP, and WebUser authentication, with optional TLS (STARTTLS) encryption.
  • Efficiency: mandatory use of CommuniGate Pro CLI "INLINE" mode, which, combined with the library's custom parser, ensures high-performance data processing.

Data Deserialization (Parser)

The Decoding section contains the core logic for parsing raw responses from the CommuniGate Pro CLI. It transforms the server's unique data format into native Go structures, handling the complexities of the protocol's grammar with high efficiency.

Key capabilities include:

  • High-Performance Parsing: uses a state-based [decodeState] with a custom character table to scan data with minimal overhead.
  • String Interning: implements a key cache to reuse common dictionary keys (like "Account", "Status", "Domain"), significantly reducing memory allocations during large data transfers.
  • CGP-Specific Types: native support for unquoted tokens, #I[address] blocks, Base64-encoded [data blocks], and specialized temporal constants (#TPAST, #TFUTURE).
  • Structural Mapping: handles recursive dictionaries ({...}), arrays ((...)), and even embedded XML or tagged objects.
  • Type Transformation: automatically converts CommuniGate Pro CLI strings like "10M" or "1h" into meaningful numeric bytes or time.Duration values via internal helper functions.

This parser is designed to be robust, handling potentially malformed or unusually large responses without compromising system stability.

Directory Administration

The Directory section provides functionality for managing CommuniGate Pro Directory Units and their access control lists (ACLs). It enables integration with LDAP-compatible data stores and manages the hierarchical structure of the system-wide directory.

Key capabilities include:

  • Unit Lifecycle: creating, relocating, and deleting local or remote Directory Units with support for shared and mount-point configurations.
  • Access Control: granular management of directory access rights via the DirAccessRight structure, including record-level and attribute-level permissions.
  • Search and Discovery: listing and retrieving configuration details for individual directory units.

Package cgpcli implements a high-performance parser and marshaler for CommuniGate Pro CLI.

Type Mapping

The library automatically maps CommuniGate Pro data structures to native Go types. The mapping logic is divided into standard protocol types and specialized field transformations based on the CGP documentation.

Standard Protocol Types:

  • Atoms & Strings: Mapped to Go string.
  • Numbers: All CGP numeric values are parsed as int64.
  • Booleans: CGP "YES" and "NO" are mapped to Go bool.
  • Arrays: Parenthesized lists (val1, val2, ...) are mapped to []any or []string.
  • Dictionaries: Key-value structures {key=val; ...} are mapped to map[string]any or map[string]string.
  • Data Blocks: Block data base64 is mapped to Go []byte.
  • IP addresses: Block data #I[ip] is converted to net.IP.

Specialized Transformations (Registry-based): To provide a more ergonomic API, cgpcli recognizes specific field names and converts their string values into rich Go types:

  • Dates: Fields like "Created" or "LastLogin" are parsed using the "DD-MM-YYYY_HH:MM:SS" layout and returned as time.Time in UTC.
  • Time Intervals (Durations): Fields representing time-outs or periods (e.g., "Timeout") support CGP-specific units like "10s", "1m", "2h", as well as "never" and "immediately". These are mapped to time.Duration.
  • Network Addresses: IP addresses in square brackets [1.2.3.4] are automatically converted to net.IP.
  • Storage Sizes: Quota and file size fields (e.g., "MaxAccountSize") supporting suffixes like "K", "M", "G" or "unlimited" are converted to int64 bytes.

Specialized Values

The library handles unique CGP constants:

  • #NULL# is mapped to nil.
  • #TPAST and #TFUTURE are mapped to specific time.Time constants provided by the library.

Domain Administration

The Domains section provides extensive functionality for managing CommuniGate Pro domains and their internal objects. It handles the domain lifecycle, inheritance of settings, and mass-object discovery.

Key capabilities include:

  • Configuration Management: handling [Domain Settings], [Effective Settings], and Domain-level [Aliases].
  • Inheritance Control: managing [Account Defaults] and [Account Templates], which dictate the initial state of new accounts within the domain.
  • Object Discovery: using Cli.ListDomainObjects to efficiently search and categorize accounts, aliases, and forwarders using filters and cookies for pagination.
  • Operational State: suspending, resuming, and locating domain storage paths.
  • Rules & Directory: managing Domain-level Mail/Signal rules and synchronizing data with the Directory Service.

Domain Set Administration

The Domain Set section provides functionality for global configuration and high-level management of the CommuniGate Pro environment. It handles operations that affect the entire server or cluster, rather than specific individual domains.

Key capabilities include:

  • Domain Lifecycle: creating and deleting domains (including [Directory Domains]), renaming, and managing physical storage mount points.
  • Cluster-Wide Defaults: managing [Cluster Domain Defaults], [Account Defaults], and [Preferences] that synchronize across all cluster nodes.
  • Server-Wide Defaults: configuring default settings and preferences used for newly created objects at the single-server level.
  • Security: managing [Trusted Certificates] (CA lists) for both Cluster and Server levels.
  • Integration: configuring system-wide [Directory Integration] settings and global telephony number (Telnums).

Data Serialization (Encoder)

The Encoding section provides methods for converting Go data structures into the CommuniGate Pro CLI protocol format. It ensures that all commands, keywords, and settings are formatted correctly according to the server's unique grammar rules.

Key capabilities include:

  • Smart String Quoting: automatically determines if a string is "safe" to send as an unquoted token or if it requires escaping and double quotes.
  • Unit Transformation: converts numeric values into CommuniGate Pro CLI size units (K, M, G, T) and durations into time units (s, m, h, d) automatically based on the context (key name).
  • Native Binary Support: efficiently encodes byte slices into Base64-wrapped [data blocks] required by the server for file transfers and certificates.
  • Temporal Handling: maps Go's time.Time to CGP's #T, #TPAST, and #TFUTURE syntax, specifically managing the UTC offset to match the server's internal time representation.
  • Recursive Structures: deep serialization of maps ({...}) and slices ((...)) with support for nested custom types.

This encoder is the core communication bridge, responsible for constructing every command and data structure sent to the server.

File Storage Administration

The Files section provides capabilities for managing the CommuniGate Pro File Storage (Web-folder) content. It allows for direct manipulation of files and directories within an account's storage area, supporting both binary data transfer and metadata management.

Key capabilities include:

  • File Operations: reading, writing, renaming, and deleting files using streaming-friendly methods like Cli.ReadStorageFile and Cli.WriteStorageFile.
  • Partial Access: support for offsets and specific data sizes, enabling efficient processing of large files.
  • Metadata & Attributes: retrieving storage statistics via StorageFileInfo and managing extended file attributes.
  • Access Control: the "AUTH" parameter in most methods allows administrators to perform operations on behalf of other accounts.
  • Subscriptions: managing file-folder subscriptions for collaborative work and synchronization.

Forwarder Administration

The Forwarders section provides methods for managing standalone mail redirection objects within CommuniGate Pro. Unlike account-level rules, Forwarders act as dedicated routing entities that redirect incoming messages to target address.

Key capabilities include:

  • Lifecycle Management: creating, renaming, and deleting forwarders.
  • Discovery: listing all forwarders in a domain or performing reverse lookups with Cli.FindForwarders to identify which objects point to a specific target address.
  • Inspection: retrieving the target address of a specific forwarder.

Group Administration

The Groups section provides functionality for managing CommuniGate Pro groups. Groups serve as versatile objects for mail distribution and signal routing.

Key capabilities include:

  • Lifecycle Management: creating, deleting, and renaming groups across the environment.
  • Membership & Configuration: using Cli.GetGroup and Cli.SetGroup to manage both group-specific settings and the list of group members simultaneously.
  • Discovery: listing all groups within a specific domain and checking for the existence of individual groups.
  • Unified Data Access: the GroupResult structure simplifies interaction by separating administrative settings from the member list.

IP List Administration

The IP List section provides specialized types and methods for handling CommuniGate Pro Network Lists (Client IP addresses, Blacklists, etc.). It implements the unique CommuniGate Pro format that allows for mixed IP addresses, CIDR masks, ranges, and sequences within a single list, including support for negative (exclusion) rules and comments.

Key capabilities include:

  • Flexible Management: adding, inserting, and deleting entries with [Cli.Add], [Cli.InsertBefore], and [Cli.InsertAfter] to maintain strict rule ordering.
  • Rule Logic: full support for exclusion rules (prefixed with "!") and complex entry types like IPRange and IPSeq.
  • IP Matching: the IPList.Contains method allows for high-performance checks to determine if a specific net.IP is matched by any rule in the list.
  • Format Preservation: methods for parsing and writing lists while maintaining comment alignment and special character encoding required by the CommuniGate Pro CLI.

Mailbox Administration

The Mailboxes section provides methods for managing account folder structures, access control lists (ACL), and mailbox-specific metadata. It supports operations for both private user folders and shared resources.

Key capabilities include:

  • Lifecycle Management: creating, renaming, and deleting mailboxes. Supports recursive operations for entire folder trees using the "MAILBOXES" keyword.
  • Access Control: granular management of permissions via Cli.GetMailboxACL and Cli.SetMailboxACL, including support for effective rights calculation.
  • Metadata & Organization: managing mailbox classes (e.g., for MAPI/Groupware compatibility) and mailbox-level aliases.
  • Discovery: listing mailbox trees with filters and retrieving detailed information such as message counts and storage size.
  • On-behalf Operations: most methods support the "AUTH" parameter, enabling administrative actions on behalf of a specific user.

Mailing Lists Administration

The Lists section provides comprehensive management of CommuniGate Pro Mailing Lists. It covers the entire lifecycle of a list, from creation and configuration to advanced subscriber management and bounce processing.

Key capabilities include:

  • List Management: creating, renaming, and deleting lists, with automatic owner account resolution.
  • Configuration: retrieving and updating list settings via Cli.GetList and Cli.UpdateList, including automated handling of CGP-specific line endings (\e).
  • Subscriber Operations: subscribing, unsubscribing, and managing posting modes (moderation) using the Cli.List and Cli.SetPostingMode methods.
  • Data Retrieval: detailed subscriber inspection through SubscriberInfo, supporting filters and pagination for large lists.
  • Maintenance: initiating bounce processing for problematic addresses and tracking delivery statistics (posts, bounces, confirmation IDs).

Miscellaneous Commands

The Miscellaneous section provides a diverse set of administrative methods for system diagnostics, real-time monitoring, and low-level server control.

Key capabilities include:

  • System Inspection: retrieving server version, OS details, start time, and cluster instances via Cli.GetSystemInfo and predefined SystemInfoKey constants.
  • Dynamic IP Protection: managing temporary blacklists and unblockable IP lists to mitigate brute-force attacks in real-time.
  • Queue Management: monitoring and managing the message delivery pipeline, including the ability to reject or release messages from SMTP queues.
  • Diagnostics & Logging: controlling trace facilities (FileIO/FileOp), toggling "Log Everything" mode, and writing custom entries to the system log.
  • Cluster Operations: force-reconnecting cluster administration channels and identifying the current Dynamic Cluster Controller.

Monitoring and Server Control

The Monitoring section provides access to the CommuniGate Pro internal statistics subsystem (SNMP-compatible). It enables real-time tracking of server performance, resource utilization, and protocol-specific metrics.

Key capabilities include:

  • Statistics Retrieval: iterating through the hierarchical OID tree using Cli.GetNextStatName and Cli.ListAllStats to discover available metrics.
  • Value Inspection: fetching current values for specific statistics elements (counters, gauges, or strings) via Cli.GetStatElement.
  • Custom Metrics: updating user-defined statistics elements using Cli.SetStatElement with "SET" or "INC" (increment) operations.
  • Signal Inspection: retrieving detailed state information for active Signal Dialogs by their numeric identifiers.
  • Server Lifecycle: gracefully initiating server termination via the Cli.Shutdown method.

Real-Time Application Administration

The PBX section provides functionality for managing CommuniGate Pro Real-Time Applications (RTA). It allows administrators to upload, retrieve, and organize files for telephony services, automated attendants, and custom signal-processing applications.

Key capabilities include:

  • Multi-Level Management: handling PBX files at different hierarchy levels: [Stock] (read-only system files), [Server], [Cluster], and [Domain].
  • File Operations: storing, reading, and deleting RTA assets such as application scripts and localized media resources (audio prompts).
  • Localization Support: managing national subsets of the RTA environment through language-specific directories.
  • Discovery: listing available PBX files at various levels to inspect the current state of custom signaling logic.

Real-Time Application Control

The RTA Control section provides methods for managing the execution of PBX (Real-Time Application) tasks. While the PBX section handles file management, this section focuses on the runtime environment and inter-process communication within the CommuniGate Pro Signal engine.

Key capabilities include:

  • Task Lifecycle: starting new PBX tasks for specific accounts using Cli.StartPBXTask with custom entry points and initial parameters.
  • Process Control: monitoring the current status of running tasks and terminating them (killing nodes) when necessary.
  • Event Management: sending asynchronous events to active tasks via Cli.SendTaskEvent, enabling interaction between the CLI and running signal applications.
  • Task Identification: each task is managed via a unique TaskID returned at startup, allowing precise control over concurrent applications.

Data Transformation and Field Registry

The Registry section provides a high-level abstraction for data transformation between CommuniGate Pro string-based protocol and Go native types. Since CommuniGate Pro CLI often returns complex types (like "10M" for sizes or "10-02-2026_12:00:00" for dates) as plain strings, this registry ensures consistent and type-safe conversion.

Key capabilities include:

  • Field Exceptions: a global map FieldExceptions that defines how specific keys (e.g., "Created", "MaxAccountSize") should be interpreted.
  • Specialized Parsers: built-in logic for handling legacy date formats, storage quotas with suffixes (K, M, G), and time durations (s, m, h, never).
  • Networking Support: automatic marshaling of IP addresses in square brackets (TypeIPSB) and comma-separated IP lists (TypeIPSBSA).
  • Extensibility: the RegisterFieldType function allows developers to add support for custom fields or override existing transformation rules.
  • Symmetric Transformation: automatic handling of both [transformRead] (from CGP to Go) and [transformWrite] (from Go to CGP syntax).

This registry is applied automatically during Query operations, making the interaction with CommuniGate Pro feel like working with a strongly-typed Go application.

Access Rights Administration

The Access Rights section handles the assignment of administrative privileges to accounts. In CommuniGate Pro, "Rights" represent a set of permissions that grant an account authority over server-wide or domain-specific administrative tasks.

Key capabilities include:

  • Privilege Management: using Cli.SetAccountRights to define a specific set of administrative permissions for any given account.
  • Granular Control: assigning predefined CommuniGate Pro rights such as "CanModifySettings", "CanCreateAccounts", or "CanManageQueues".

Router Table Administration

The Router section provides specialized structures and methods for managing the CommuniGate Pro Routing Table. The Router is the central engine that determines how every message, signal, or call is directed within the server or to external destinations.

Key capabilities include:

  • Ordered Management: RouterList ensures that the strict top-to-bottom evaluation order of CommuniGate Pro routing rules is preserved during manipulation.
  • Pattern-Based Insertion: methods like RouterList.InsertBefore and RouterList.InsertAfter allow for precise rule placement without overwriting the entire table manually.
  • Metadata Preservation: full support for comments and alignment positions (Pos), ensuring that the table remains readable in the WebAdmin interface.
  • Format Compatibility: automatic handling of the internal multi-line representation and special character escaping required by the CLI.

Use these structures to automate complex routing tasks, such as dynamic gateway switching, anti-spam redirection, or multi-domain mail flow management.

Rules Administration

The Rules section provides specialized management for message and signal processing logic. CommuniGate Pro uses a rule-based engine to automate actions like filtering, forwarding, or complex VoIP call routing.

Key capabilities include:

  • Dual-Engine Support: separate structures and methods for MailRule (standard mail processing) and SignalRule (SIP/Signal processing).
  • Priority Logic: automatic handling of "packed" priorities in Signal rules, where the library transparently manages delays and event codes (e.g., Error, Busy, No Answer).
  • Flexible Conditions & Actions: rules are represented as structured slices, allowing for complex nested logic as defined in CommuniGate Pro.
  • Generics-Powered Operations: unified internal logic for setting and updating rules using Go Generics to ensure type safety across different rule levels.

Synchronous Script Execution

The Scripts section provides methods for executing CommuniGate Pro Programming Language (CG/PL) scripts in a synchronous manner. Unlike standard PBX tasks that run asynchronously, these methods block until the script completes, returning the execution result directly to the caller.

Key capabilities include:

  • Immediate Execution: using Cli.RunScript to trigger a specific program and entry point within the context of an account.
  • Data Exchange: passing complex parameters via a map and receiving structured results (any type supported by CommuniGate Pro CLI) back into the Go application.
  • Contextual Execution: scripts run within the environment of a specified account, respecting its settings and storage access.

This section is ideal for performing complex calculations, data transformations, or administrative tasks that require immediate feedback and logic implemented in CG/PL.

Server Settings

The Server Settings section is the core of the library, providing comprehensive access to the CommuniGate Pro configuration engine. It allows for the management of both node-local and cluster-wide parameters, ensuring consistency across multi-server environments.

Key capabilities include:

  • Network Security: management of various IP address lists including Blacklisted, Client (Trusted), LAN, and Denied IPs for granular access control.
  • Routing & Rules: integration with RouterList, MailRule, and SignalRule at both Server and Cluster levels.
  • Module Configuration: dynamic retrieval and updates for specific protocol modules (SMTP, IMAP, SIP, etc.) via Cli.GetModule and Cli.UpdateModule.
  • Content Filtering: controlling prohibited content through the BannedLines structure for headers and message bodies.
  • Global Subsystems: fine-tuning of DNR (Domain Name Resolver), Logging, Queue Management, and Session settings.

Account Services

The Account Services section provides access to user-specific application data and billing operations. These methods interface with the high-level subsystems of CommuniGate Pro that handle real-time user interactions and resource accounting.

Key capabilities include:

  • Billing & Quotas: using the Cli.Balance method to perform complex financial operations, including balance inquiries, credit reservations, and service charging.
  • Data Management: interacting with account-level datasets (such as collected addresses) via Cli.Dataset and Cli.RemoveAccountSubset.
  • Instant Messaging: managing the XMPP/SIP Cli.Roster, allowing for programmatic contact list manipulation, subscription management, and presence monitoring.

Statistics

The Statistics section provides methods for monitoring the activity and resource consumption of specific domains and individual accounts. These metrics are invaluable for usage auditing, billing verification, and identifying unusual activity patterns.

Key capabilities include:

  • Granular Monitoring: retrieving specific counters or the entire statistics dictionary for an account or domain.
  • Reset Mechanisms: clearing accumulated counters via Cli.ResetAccountStat and Cli.ResetDomainStat, allowing for periodic (e.g., monthly or daily) reporting cycles.
  • Resource Tracking: accessing data related to protocol usage, login frequency, and storage interaction at the entity level.

Named Task Administration

The Named Tasks section provides management for the CommuniGate Pro internal scheduler. Named Tasks allow administrators and users to automate actions (such as executing CG/PL scripts) based on specific time intervals or calendar schedules.

Key capabilities include:

  • Lifecycle Management: creating, renaming, and deleting tasks associated with specific accounts using Cli.CreateNamedTask and Cli.DeleteNamedTask.
  • Configuration: retrieving and updating task parameters.
  • Discovery: listing tasks at both account and domain levels to monitor automated workflows across the server.
  • Owner Resolution: automatic handling of account names, ensuring tasks are correctly linked to the local part of the account address.

Temporary IP List Management

The TempIP section provides advanced structures for handling transient IP address lists in CommuniGate Pro. These lists are primarily used for dynamic security measures, such as temporary blacklisting of failed login attempts or short-term "unblockable" exceptions.

Key capabilities include:

  • Structured Representation: the TempIP struct associates an IP address with its remaining time-to-live (TTL) or a permanent status flag.
  • Efficient Lookups: TempIPList uses a fixed-size IPKey ([16]byte) based map for O(1) IP address lookups, handling both IPv4 and IPv6 transparently.
  • Robust Parsing: optimized parsing logic in [parseTempIPsToMap] that extracts IPs and their durations from raw protocol strings with minimal allocations.
  • Local Drafting: methods like TempIPList.Add and TempIPList.Delete allow for building or modifying lists locally before committing them to the server.

Specialized Protocol Types

The Types section defines the fundamental building blocks of the CommuniGate Pro CLI protocol syntax. It maps CGP-specific data representations to native Go structures, ensuring that complex data types are marshaled and unmarshaled with bit-perfect accuracy.

Key components include:

  • Atoms: the Atom type represents unquoted strings used for commands, keywords, and object identifiers where standard quoting would cause syntax errors.
  • Network Addresses: CGPIP handles the server's unique #I[address]:port format, supporting both IPv4 and IPv6 with optional port numbers.
  • Temporal Constants: predefined TimePast (#TPAST) and TimeFuture (#TFUTURE) constants for handling expiration dates and schedule limits.
  • Binary Data: DataBlock provides a container for raw bytes (like SSL certificates) that require specific encapsulation during transmission.
  • Session Offsets: enumerated constants for navigating data streams (OffsetBeg, OffsetEnd, OffsetNew).

These types are used throughout the library to maintain strict compliance with the CommuniGate Pro data model while providing a developer-friendly API.

Utilities

The Utilities section provides developer-focused functions for data visualization and debugging. When working with the CommuniGate Pro CLI, responses often arrive as deeply nested structures of maps and slices; these utilities simplify the inspection of such data.

Key capabilities include:

  • Recursive Visualization: PrettyPrint allows for a clean, indented tree-view output of any data structure returned by the CLI.
  • Sorted Inspection: maps are automatically sorted by key during output, ensuring consistent and predictable debugging sessions.
  • Type Metadata: each value in the pretty-printed output is annotated with its Go type information, making it easier to map CLI responses to application logic.
  • Formatted Time: date and time objects are rendered in a human-readable format, bypassing the default verbose time.Time representation.

These functions are intended for use during the development and troubleshooting phases to verify the integrity of data received from the server.

Web Interface Integration

The Web Interface section provides methods for managing user sessions across various CommuniGate Pro protocols, including WebUser, XIMSS, and Lite sessions. These methods are essential for building custom web portals, implementing Single Sign-On (SSO), and managing active connections.

Key capabilities include:

  • Session Creation: programmatically initiating WebUser, XIMSS, or Lite sessions for accounts via Cli.CreateWebUserSession and related methods.
  • Multi-Factor Authentication: supporting the 2FA flow by finalizing authentication steps with Cli.BlessSession.
  • Session Discovery & Inspection: locating active sessions by IP address, protocol, or client type using Cli.FindAccountSession and Cli.GetSession.
  • Resource Management: handling session-bound file uploads and storage via Cli.StoreSessionFile, supporting various offsets for partial data.
  • Lifecycle Control: terminating specific sessions with Cli.KillSession or updating session-specific metadata with Cli.UpdateSession.

Web Skins Administration

The Web Skins section provides comprehensive management for CommuniGate Pro WebUser interface customizations. It allows developers to manipulate skins at three distinct hierarchy levels: Server, Cluster, and Domain.

Key capabilities include:

  • Hierarchy Management: creating, renaming, and deleting custom skins at different scopes (Server, Cluster, or Domain-specific).
  • File Operations: full CRUD support for individual skin files, enabling programmatic updates to HTML templates, CSS, and images via Cli.StoreServerSkinFile and related methods.
  • Stock Skin Access: ability to read and list files from built-in "stock" skins provided by the server for reference or inheritance.
  • Metadata Tracking: retrieving file content along with its modification timestamp (time.Time) for efficient caching and synchronization.
  • Discovery: listing available skins and inspecting their file contents at each hierarchy level.

Index

Constants

View Source
const (
	CodeOk       CliCode = 200
	CodeOkInline         = 201
	CodePassword         = 300 // Server expects a password
	CodeGenErr           = 500
	CodeGenErr1          = 501
	CodeGenErr12         = 512
	CodeGenErr25         = 525
	CodeGenErr99         = 599
	CodeStrange          = 10000
)
View Source
const (
	EventError    = 1 // 100
	EventBusy     = 3 // 300
	EventNoAnswer = 5 // 500
)

Variables

View Source
var (
	TimePast   = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
	TimeFuture = time.Date(2099, 12, 31, 23, 59, 59, 0, time.UTC)
)

Специальные метки времени CGP. Используются для представления #TPAST и #TFUTURE.

View Source
var FieldExceptions = map[string]FieldType{

	"Created": TypeDateLegacy,

	"BlockedLoginTime":      TypeDuration,
	"BlockedLoginsPeriod":   TypeDuration,
	"CacheNegative":         TypeDuration,
	"DefaultRegister":       TypeDuration,
	"DeleteInterval":        TypeDuration,
	"DequeuerWaitTime":      TypeDuration,
	"DialogMediaIdle":       TypeDuration,
	"DialogSignalIdle":      TypeDuration,
	"DialogTimeLimit":       TypeDuration,
	"InitialWait":           TypeDuration,
	"LDAPPagedCacheTimeout": TypeDuration,
	"MaxRegister":           TypeDuration,
	"MinRegister":           TypeDuration,
	"NATTCPPingPeriod":      TypeDuration,
	"NATUDPPingPeriod":      TypeDuration,
	"ProtocolErrorsPeriod":  TypeDuration,
	"RestartPause":          TypeDuration,
	"SessionTimeLimit":      TypeDuration,
	"SwapInterval":          TypeDuration,
	"TCPTimeWait":           TypeDuration,
	"TempClientTime":        TypeDuration,
	"TempUnBlockableTime":   TypeDuration,
	"TimeLimit":             TypeDuration,
	"Timeout":               TypeDuration,

	"ArchiveSizeLimit": TypeSize,
	"DigestSizeLimit":  TypeSize,
	"MaxAccountSize":   TypeSize,
	"MaxFileSize":      TypeSize,
	"MaxMailboxSize":   TypeSize,
	"MaxMailOutSize":   TypeSize,
	"MaxMessageSize":   TypeSize,
	"MaxWebSize":       TypeSize,
	"MBOXSizeToIndex":  TypeSize,
	"SizeLimit":        TypeSize,

	"DNSServers":  TypeIPSBSA,
	"DummyIPs":    TypeIPList,
	"LANAddress":  TypeIPSB,
	"WANAddress":  TypeIPSB,
	"WAN6Address": TypeIPSB,
}

FieldExceptions is the global registry of field-to-type mappings. It contains predefined rules for core CommuniGate Pro fields.

Functions

func MarshalTo

func MarshalTo(w *bufio.Writer, v any) error

MarshalTo serializes v directly into a buffered writer. This is the preferred function for high-performance operations or large data sets to avoid intermediate string allocations.

Parameters:

  • w: a pointer to a *bufio.Writer where the serialized data will be written.
  • v: the data structure to be serialized.

Returns:

  • error: an error if writing to the buffer fails or if the data is invalid.

func MarshalToString

func MarshalToString(v any) (string, error)

MarshalToString returns the CGP-formatted string representation of v.

Parameters:

  • v: the data to be serialized. Can be any basic Go type (string, int, bool, time.Time), a map[string]any, or a slice.

Returns:

  • string: a string ready to be sent to the CommuniGate Pro CLI.
  • error: an error if the data structure contains types that cannot be serialized.

func PrettyPrint

func PrettyPrint(v any)

PrettyPrint prints a data structure to the standard output in a human-readable format.

It recursively traverses maps, slices, and basic types, providing indentation and type annotations. This is especially useful for inspecting complex dictionaries returned by the CommuniGate Pro CLI.

Parameters:

  • v: the data structure to be printed.

func RegisterFieldType

func RegisterFieldType(name string, t FieldType)

RegisterFieldType adds or overrides a field mapping in the global registry FieldExceptions. Use this to support new CommuniGate Pro fields or change how existing fields are interpreted by the library's transformation engine.

Parameters:

  • name: the exact key name as it appears in the CommuniGate Pro protocol (e.g., "MyCustomTimeout").
  • t: the target FieldType which defines the transformation logic.

Note: This function must be called before initializing any new CLI sessions via New. The recommended approach is to call RegisterFieldType within an init() function in your application. You can call it as many times as necessary to register all required field exceptions.

Example:

func init() {
    cgpcli.RegisterFieldType("CustomQuota", cgpcli.TypeSize)
}

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal parses the CGP-formatted data and stores the result in the value pointed to by v.

Parameters:

  • data: a byte slice containing the raw response from the CommuniGate Pro CLI. This can be a simple word, a dictionary, an array or a complex nested types.
  • v: a non-nil pointer to the destination variable. If v is a pointer to an interface{}, Unmarshal will populate it with map[string]any, []any, int64, bool, or string, depending on the source data.

Returns:

  • error: an error if v is not a pointer, is nil, or if the data cannot be correctly mapped to the target type.

Types

type AccountType

type AccountType int

AccountType represents the storage and management type of a CommuniGate Pro account.

const (
	// TypeDefault uses the default storage type defined for the Domain.
	TypeDefault AccountType = iota

	// MultiMailbox represents a standard multi-mailbox account.
	MultiMailbox

	// TextMailbox represents a legacy text-based single mailbox account.
	TextMailbox

	// MailDirMailbox represents an account using MailDir storage format.
	MailDirMailbox

	// SlicedMailbox represents an account using Sliced storage format.
	SlicedMailbox

	// AGrade, BGrade, CGrade, DGrade represent special account types
	AGrade
	BGrade
	CGrade
	DGrade
)

func (AccountType) String

func (t AccountType) String() string

type Atom

type Atom string

Atom represents a string that is always transmitted without quotes. It is used for commands, keywords, and object identifiers where standard CLI quoting would result in a syntax error.

type BannedLines

type BannedLines struct {
	BodyLines   []string // banned strings in the message body.
	HeaderLines []string // banned strings in the message headers.
}

BannedLines represents lists of prohibited strings in message headers and bodies.

type CGPIP

type CGPIP struct {
	IP   net.IP // IP is the network address (IPv4 or IPv6).
	Port int    // Port is the optional port number (0 means no port).
}

CGPIP represents the specific CommuniGate Pro IP Address data type. It follows the protocol format: #I[address] or #I[address]:port.

func (CGPIP) IsZero

func (c CGPIP) IsZero() bool

IsZero returns true if the IP address is not set.

func (CGPIP) String

func (c CGPIP) String() string

String returns the standard human-readable representation of the IP. For example: "1.2.3.4:25" or "2001::1".

type Cli

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

Cli represents a CommuniGate Pro CLI client session. It handles connection persistence, automatic reconnection, and command marshaling. Use New() to initialize a session.

func New

func New(host, login, password string, secure Secure, tls bool) (*Cli, error)

New creates and initializes a new CommuniGate Pro CLI session. It establishes a connection, performs authentication, and sets the session to INLINE mode for efficient data exchange.

Parameters:

  • host: the server hostname or IP address.
  • login: the administrative or user login name.
  • password: the password for authentication.
  • secure: the security mode to use (Plain, APOP, or WebUser).
  • tls: if true, attempts to upgrade the connection via STARTTLS.

Returns:

  • *Cli: a pointer to the initialized session.
  • error: an error if the command fails.

func (*Cli) Balance

func (cli *Cli) Balance(account string, params map[string]any) (map[string]any, error)

Balance manages Account Billing Balances.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • params: a dictionary containing the "op" string element (list, reserve, release, charge, credit, read, readAll, history, remove) and operation-specific data.

This method executes the BALANCE CLI command.

Returns:

  • map[string]any: a dictionary with the billing operation results.
  • error: an error if the command fails.

func (*Cli) BlessSession

func (cli *Cli) BlessSession(sessionID string, secret, account string) error

BlessSession completes the second stage of a Two-factor authentication process for the given session.

Parameters:

  • sessionID: the Session ID.
  • secret: an optional the one-time secret used with Two-factor Authentication.
  • account: an optional the name of the Account the session belongs to.

This method executes the BLESSSESSION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CheckAccountPassword

func (cli *Cli) CheckAccountPassword(account, password string) (bool, error)

CheckAccountPassword verifies if the provided password matches the Account's password.

Parameters:

  • account: the name of the Account to check.
  • password: the plain-text password to verify against the server record.

This is a helper method that performs a client-side comparison by retrieving the plain-text password from the server.

Important: Unlike VerifyAccountPassword(), this method does NOT trigger the "External Authentication" helper. This makes it safe to use within the External Authentication helper itself to verify credentials against the local CommuniGate Pro storage without causing recursive loops.

Note: This method only works if the Account's password is stored using a reversible encryption method.

Returns:

  • (true, nil) if the passwords match.
  • (false, nil) if the passwords do not match.
  • (false, error) if the password cannot be retrieved or verified.

func (*Cli) Close

func (cli *Cli) Close() (err error)

Close gracefully terminates the CommuniGate Pro CLI session.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateAccount

func (cli *Cli) CreateAccount(account string, settings map[string]any, accType AccountType, storage string, legacy bool) error

CreateAccount creates a new Account.

Parameters:

  • account: the name for the new Account. The name can contain the @ symbol followed by the Domain name; otherwise, the Account is created in the administrator Domain.
  • settings: an optional dictionary with the initial Account settings. If specified, it is used to modify the Template settings for the target Domain.
  • accType: an optional Account type (e.g., MultiMailbox, MailDirMailbox). If TypeDefault is used, a MultiMailbox-type Account is created.
  • storage: an optional "storage mount point" directory for the Account data (without the .mnt suffix).
  • legacy: if true, creates the Account with a Legacy (visible for legacy mailers) INBOX.

This method executes the CREATEACCOUNT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateAccountStorage

func (cli *Cli) CreateAccountStorage(domain, storage string) error

CreateAccountStorage creates a "storage mount point" for new Accounts in the Domain.

Parameters:

  • domain: the Domain name.
  • storage: the "storage mount Point" name.

This method executes the CREATEACCOUNTSTORAGE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateClusterPBX

func (cli *Cli) CreateClusterPBX(language string) error

CreateClusterPBX creates the cluster-wide Real-Time Application Environment or its national subset.

Parameters:

  • language: a national subset name.

This method executes the CREATECLUSTERPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateClusterSkin

func (cli *Cli) CreateClusterSkin(skin string) error

CreateClusterSkin creates a custom Cluster Skin.

Parameters:

  • skin: the name of the new Skin.

This method executes the CREATECLUSTERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDirectoryDomain

func (cli *Cli) CreateDirectoryDomain(domain string, settings map[string]any) error

CreateDirectoryDomain creates a new directory-based Domain. This operation is allowed only when the Directory-based Domains are enabled.

Parameters:

  • domain: the Domain name to create.
  • settings: an optional dictionary specifying the Domain settings.

This method executes the CREATEDIRECTORYDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDirectoryUnit

func (cli *Cli) CreateDirectoryUnit(unit, mountPoint string, shared, remote bool) error

CreateDirectoryUnit creates a new Directory Unit.

Parameters:

  • unit: the new Unit name.
  • mountPoint: the new Unit mount point (mount DN).
  • shared: if true, a cluster-wide Directory Unit is created.
  • remote: if true, a Remote (LDAP-based) Directory Unit is created, otherwise a Local (File-based) Directory Unit is created.

This method executes the CREATEDIRECTORYUNIT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDomain

func (cli *Cli) CreateDomain(domain string, settings map[string]any, storage string, shared bool) error

CreateDomain creates a new secondary Domain.

Parameters:

  • domain: the Domain name to create.
  • shared: if true, creates a Cluster-wide Domain (Dynamic Cluster only).
  • storage: an optional "storage mount point" directory name (without .mnt suffix).
  • settings: an optional dictionary specifying the initial Domain settings.

This method executes the CREATEDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDomainPBX

func (cli *Cli) CreateDomainPBX(domain, language string) error

CreateDomainPBX creates the Domain Real-Time Application Environment or its national subset.

Parameters:

  • domain: the Domain name.
  • language: an optional national subset name.

This method executes the CREATEDOMAINPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDomainSkin

func (cli *Cli) CreateDomainSkin(domain, skin string) error

CreateDomainSkin creates a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of the new Skin. To create the unnamed Domain Skin, specify an empty string.

This method executes the CREATEDOMAINSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateDomainStorage

func (cli *Cli) CreateDomainStorage(storage string, shared bool) error

CreateDomainStorage creates a "storage mount point" for new Domains.

Parameters:

  • storage: the "storage mount Point" name.
  • shared: if true, creates a mount point for Cluster Domains in a Dynamic Cluster.

This method executes the CREATEDOMAINSTORAGE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateForwarder

func (cli *Cli) CreateForwarder(forwarder, address string) error

CreateForwarder creates new Forwarders.

Parameters:

  • forwarder: the name for the new Forwarder. The name can contain the @ symbol followed by the Domain name, in this case the Forwarder is created in the specified Domain. If the Domain name is not specified, the command applies to the administrator Domain.
  • address: the E-mail address the Forwarder should reroute E-mail messages and Signals to.

This method executes the CREATEFORWARDER CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateGroup

func (cli *Cli) CreateGroup(group string, settings map[string]any) error

CreateGroup creates new Groups.

Parameters:

  • group: the name for the new Group. The name can include the Domain name, in this case the Group is created in the specified Domain. If the Domain name is not specified, the command applies to the administrator Domain.
  • settings: an optional initial Group settings and the members list.

This method executes the CREATEGROUP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateList

func (cli *Cli) CreateList(list, account string) error

CreateList creates a mailing list.

Parameters:

  • list: the name of a mailing list to create. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • account: the name of the mailing list owner. It should be the name of an already existing Account in the mailing list Domain.

This method executes the CREATELIST CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateLiteSession

func (cli *Cli) CreateLiteSession(addr, origAddr string) (string, error)

CreateLiteSession creates a LITE session.

Parameters:

  • addr: the IP address and port of the client browser.
  • origAddr: an optional the original IP address of the client browser, if the client connects via a proxy.

This method executes the CREATELITESESSION CLI command.

Returns:

  • string: the LITE Session ID.
  • error: an error if the command fails.

func (*Cli) CreateMailbox

func (cli *Cli) CreateMailbox(account, mailbox, class, authAccount string) error

CreateMailbox creates a Mailbox in the specified Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name for the new Mailbox.
  • class: mailbox class for the new Mailbox.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the MAILBOX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateNamedTask

func (cli *Cli) CreateNamedTask(task, account string) error

CreateNamedTask creates a new Named Task.

Parameters:

  • task: the name for the new Named Task. Can include the @ symbol followed by the Domain name. If the Domain name is not specified, the command applies to the administrator Domain.
  • account: the owner Account name.

This method executes the CREATENAMEDTASK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateServerPBX

func (cli *Cli) CreateServerPBX(language string) error

CreateServerPBX creates the Server-wide Real-Time Application Environment or its national subset.

Parameters:

  • language: a national subset name.

This method executes the CREATESERVERPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateServerSkin

func (cli *Cli) CreateServerSkin(skin string) error

CreateServerSkin creates a custom Server Skin.

Parameters:

  • skin: the name of the new Skin.

This method executes the CREATESERVERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) CreateWebUserSession

func (cli *Cli) CreateWebUserSession(account, addr, origAddr, skin string) (string, error)

CreateWebUserSession creates a WebUser session for the specified Account.

Parameters:

  • account: the Account name.
  • addr: the IP address and port of the client browser.
  • origAddr: an optional the original IP address of the client browser, if the client connects via a proxy.
  • skin: an optional the Skin to use for the newly created session.

This method executes the CREATEWEBUSERSESSION CLI command.

Returns:

  • string: the WebUser Session ID.
  • error: an error if the command fails.

func (*Cli) CreateXimssSession

func (cli *Cli) CreateXimssSession(account, addr, origAddr string) (string, error)

CreateXimssSession creates a XIMSS session for the specified Account.

Parameters:

  • account: the Account name.
  • addr: the IP address and port of the client browser.
  • origAddr: an optional the original IP address of the client browser, if the client connects via a proxy.

This method executes the CREATEXIMSSSESSION CLI command.

Returns:

  • string: the XIMSS Session ID.
  • error: an error if the command fails.

func (*Cli) Dataset

func (cli *Cli) Dataset(account string, params map[string]any) (map[string]any, error)

Dataset manages Account "datasets".

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • params: a dictionary containing: subsetName: (string) Target dataset or dataset subset; what: (string) The operation to apply: listSubsets: Lists all subsets of the specified dataset; createSet: Creates the specified dataset; removeSet: Removes the specified dataset; listEntries: Lists subset entries; setEntry: Creates or updates an entry; deleteEntry: Removes the specified entry; addRandomEntry: Adds a new entry with a generated name; findAddress: Finds an entry by "addressbook.Email" attribute.

This method executes the DATASET CLI command.

Returns:

  • map[string]any: a dictionary with the operation results.
  • error: an error if the command fails.

func (*Cli) DeleteAccount

func (cli *Cli) DeleteAccount(account string) error

DeleteAccount removes an existing Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

This method executes the DELETEACCOUNT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteAccountMailRule

func (cli *Cli) DeleteAccountMailRule(account, rule string) error

DeleteAccountMailRule removes a Mail Rule from an existing Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rule: the name of the MailRule to be removed.

If the specified Mail Rule does not exist, the command does nothing and does not return an error.

This method executes the UPDATEACCOUNTMAILRULE CLI command with the DELETE keyword.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteAccountSignalRule

func (cli *Cli) DeleteAccountSignalRule(account, rule string) error

DeleteAccountSignalRule removes a Signal Rule from an existing Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rule: the name of the SignalRule to be removed.

If the specified Signal Rule does not exist, the command does nothing and does not return an error.

This method executes the UPDATEACCOUNTSIGNALRULE CLI command with the DELETE keyword.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteClusterPBX

func (cli *Cli) DeleteClusterPBX(language string) error

DeleteClusterPBX removes a national subset from the cluster-wide Real-Time Application Environment.

Parameters:

  • language: a national subset name.

This method executes the DELETECLUSTERPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteClusterPBXFile

func (cli *Cli) DeleteClusterPBXFile(file string) error

DeleteClusterPBXFile removes a specific file from the cluster-wide Real-Time Application Environment.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".

This method executes the STORECLUSTERPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteClusterSkin

func (cli *Cli) DeleteClusterSkin(skin string) error

DeleteClusterSkin deletes a custom Cluster Skin.

Parameters:

  • skin: the name of the Skin to be deleted.

This method executes the DELETECLUSTERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteClusterSkinFile

func (cli *Cli) DeleteClusterSkinFile(skin, file string) error

DeleteClusterSkinFile removes a file from a custom Cluster Skin.

Parameters:

  • skin: the name of an existing Cluster Skin.
  • file: the Skin file name to be deleted.

This method executes the STORECLUSTERSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDirectoryRecords

func (cli *Cli) DeleteDirectoryRecords(domain string) error

DeleteDirectoryRecords deletes Domain object records from the Directory.

Parameters:

  • domain: the Domain name. If empty, applies to the authenticated user Domain.

This method executes the DELETEDIRECTORYRECORDS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDirectoryUnit

func (cli *Cli) DeleteDirectoryUnit(unit string, shared bool) error

DeleteDirectoryUnit removes an existing Directory Unit.

Parameters:

  • unit: the Directory Unit name.
  • shared: if true, this is a cluster-wide Directory Unit name.

This method executes the DELETEDIRECTORYUNIT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDomain

func (cli *Cli) DeleteDomain(domain string, force bool) error

DeleteDomain removes an existing Domain.

Parameters:

  • domain: the name of the Domain to be removed.
  • force: if true, removes the Domain even if it contains accounts or other objects.

This method executes the DELETEDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDomainPBX

func (cli *Cli) DeleteDomainPBX(domain, language string) error

DeleteDomainPBX removes a national subset from the Domain Real-Time Application Environment.

Parameters:

  • domain: the Domain name.
  • language: a national subset name.

This method executes the DELETEDOMAINPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDomainPBXFile

func (cli *Cli) DeleteDomainPBXFile(domain, file string) error

DeleteDomainPBXFile removes a specific file from the Domain Real-Time Application Environment.

Parameters:

  • domain: the Domain name.
  • file: the file name. For national subsets, specify "language/fileName".

This method executes the STOREDOMAINPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDomainSkin

func (cli *Cli) DeleteDomainSkin(domain, skin string) error

DeleteDomainSkin deletes a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of the Skin to be deleted. To delete the unnamed Domain Skin, specify an empty string.

This method executes the DELETEDOMAINSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteDomainSkinFile

func (cli *Cli) DeleteDomainSkinFile(domain, skin, file string) error

DeleteDomainSkinFile removes a file from a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of an existing Domain Skin.
  • file: the Skin file name to be deleted.

This method executes the STOREDOMAINSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteForwarder

func (cli *Cli) DeleteForwarder(forwarder string) error

DeleteForwarder removes Forwarders.

Parameters:

  • forwarder: the name of an existing Forwarder. The name can include the Domain name.

This method executes the DELETEFORWARDER CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteGroup

func (cli *Cli) DeleteGroup(group string) error

DeleteGroup removes Groups.

Parameters:

  • group: the name of an existing Group. The name can include the Domain name.

This method executes the DELETEGROUP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteList

func (cli *Cli) DeleteList(list string) error

DeleteList removes a mailing list.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.

This method executes the DELETELIST CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteMailbox

func (cli *Cli) DeleteMailbox(account, mailbox string, recursive bool, authAccount string) error

DeleteMailbox removes a Mailbox from the specified Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of the Mailbox to be deleted.
  • recursive: if true, the keyword MAILBOXES is used, and all nested Mailboxes (submailboxes) are deleted, too.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the MAILBOX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteNamedTask

func (cli *Cli) DeleteNamedTask(task string) error

DeleteNamedTask removes an existing Named Task.

Parameters:

  • task: the name of an existing Named Task. The name can include the Domain name.

This method executes the DELETENAMEDTASK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteServerPBX

func (cli *Cli) DeleteServerPBX(language string) error

DeleteServerPBX removes a national subset from the Server-wide Real-Time Application Environment.

Parameters:

  • language: a national subset name.

This method executes the DELETESERVERPBX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteServerPBXFile

func (cli *Cli) DeleteServerPBXFile(file string) error

DeleteServerPBXFile removes a specific file from the Server-wide Real-Time Application Environment.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".

This method executes the STORESERVERPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteServerSkin

func (cli *Cli) DeleteServerSkin(skin string) error

DeleteServerSkin deletes a custom Server Skin.

Parameters:

  • skin: the name of the Skin to be deleted.

This method executes the DELETESERVERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteServerSkinFile

func (cli *Cli) DeleteServerSkinFile(skin, file string) error

DeleteServerSkinFile removes a file from a custom Server Skin.

Parameters:

  • skin: the name of an existing Server Skin.
  • file: the Skin file name to be deleted.

This method executes the STORESERVERSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DeleteStorageFile

func (cli *Cli) DeleteStorageFile(account, file, authAccount string) error

DeleteStorageFile removes a file or a file directory from the Account File Storage.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • file: the name of the existing File Storage file or directory.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the DELETESTORAGEFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) DumpAllObjects

func (cli *Cli) DumpAllObjects(file bool) error

DumpAllObjects writes the list of all application data objects.

Parameters:

  • file: if true, the objects_dump.txt file is created in the Server base directory. If false, the list is written into the OS syslog.

Note: This list may contain millions of objects and can overload the OS syslog. It also effectively suspends CommuniGate Pro Server activities till all objects are listed.

This method executes the DUMPALLOBJECTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) Echo

func (cli *Cli) Echo(obj any) (any, error)

Echo produces an output which is a copy of the command parameter object.

Parameters:

  • obj: the object (string, dictionary, array, etc.) to be echoed back by the server.

This method executes the ECHO CLI command.

Returns:

  • any: the exact copy of the input object as returned by the server.
  • error: an error if the command fails.

func (*Cli) FindAccountSession

func (cli *Cli) FindAccountSession(account, addr, origAddr, protocol, transport, client string) (string, error)

FindAccountSession finds an existing session for the specified Account.

Parameters:

  • account: the Account name.
  • addr: an optional the IP address of the client browser.
  • origAddr: an optional the IP address of the client browser, if this browser is located behind an HTTP proxy.
  • protocol: an optional the Session protocol (WebUser, XIMSS, XMPP, etc.).
  • transport: an optional the Session transport (HTTP, XIMSS, XMPP, etc.).
  • client: an optional the Session client.

This method executes the ADDRESS CLI command.

Returns:

  • string: the Session ID.
  • error: an error if the command fails.

func (*Cli) FindForwarders

func (cli *Cli) FindForwarders(domain, address string) ([]string, error)

FindForwarders finds all Forwarders pointing to the specified address.

Parameters:

  • domain: the Domain name.
  • address: an E-mail address to look for.

This method executes the FINDFORWARDERS CLI command.

Returns:

  • []string: an array with the found Forwarder names.
  • error: an error if the command fails.

func (*Cli) GetAccountACL

func (cli *Cli) GetAccountACL(account, authAccount string) (map[string]any, error)

GetAccountACL retrieves the Access Control Lists (ACLs) for an Account.

Parameters:

  • account: the name of an existing Account (target Account). The asterisk (*) symbol can be used to specify the current authenticated Account.
  • authAccount: an optional name of an Account on whose behalf the operation is executed. If specified, the ACL info is returned only if that Account has the Admin access right for the target Account.

This method executes the GETACCOUNTACL CLI command.

Returns:

  • map[string]any: a dictionary containing the ACL elements.
  • error: an error if the command fails.

func (*Cli) GetAccountACLRights

func (cli *Cli) GetAccountACLRights(account, authAccount string) (string, error)

GetAccountACLRights retrieves the effective access rights for a specific Account.

Parameters:

  • account: the name of an existing Account (target Account). The asterisk (*) symbol can be used to specify the current authenticated Account.
  • authAccount: the name of an Account whose effective access rights for the target Account should be retrieved.

This method executes the GETACCOUNTACLRIGHTS CLI command.

Returns:

  • string: a string with the effective access rights.
  • error: an error if the command fails.

func (*Cli) GetAccountAccessModes

func (cli *Cli) GetAccountAccessModes(account string) ([]string, error)

GetAccountAccessModes retrieves the enabled services (AccessModes) for an Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

The AccessMode setting specifies Enabled Services. The returned slice of strings represents the names of the enabled services.

Special values:

  • If the setting is "All", the method returns []string{"All"}.
  • If the setting is "None" or empty, the method returns an empty slice.
  • If the setting is an array, the method skips the first element (the numeric threshold) and returns the names of the explicitly listed services.

Supported services include: Mail, POP, IMAP, WebMail, PWD, Agent, WebSite, Relay, Roaming, FTP, MAPI, TLS, S/MIME, LDAP, WebCAL, RADIUS, SIP, PBX, XMPP, XIMSS, Signal, AirSync, HTTP, MobilePBX, XMedia, YMedia, MobileClient, ClientMail, ClientIM, ClientVoIP.

Returns:

  • []string: a slice containing the names of enabled services.
  • error: an error if the command fails.

func (*Cli) GetAccountAlerts

func (cli *Cli) GetAccountAlerts(account string) (map[string]string, error)

GetAccountAlerts retrieves the Account Alerts.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.

This method executes the GETACCOUNTALERTS CLI command.

Returns a map[string]string containing the alerts and timestamps, or an error if the account name is empty or the server fails to execute the command.

This method executes the GETACCOUNTALERTS CLI command.

func (*Cli) GetAccountAliases

func (cli *Cli) GetAccountAliases(account string) ([]string, error)

GetAccountAliases retrieves the list of Account aliases.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

This method executes the GETACCOUNTALIASES CLI command.

Returns:

  • []string: a slice of alias name strings.
  • error: an error if the command fails.

func (*Cli) GetAccountDefaultPrefs

func (cli *Cli) GetAccountDefaultPrefs(domain string) (map[string]any, error)

GetAccountDefaultPrefs retrieves the Default Account Preferences for the specified Domain.

Parameters:

  • domain: the Domain name. If empty, applies to the administrator Domain.

This method executes the GETACCOUNTDEFAULTPREFS CLI command.

Returns:

  • map[string]any: a dictionary with the default Preferences.
  • error: an error if the command fails.

func (*Cli) GetAccountDefaults

func (cli *Cli) GetAccountDefaults(domain string) (map[string]any, error)

GetAccountDefaults retrieves the default Account settings for the specified Domain.

Parameters:

  • domain: the Domain name. If empty, applies to the administrator Domain.

This method executes the GETACCOUNTDEFAULTS CLI command.

Returns:

  • map[string]any: a dictionary with the default settings.
  • error: an error if the command fails.

func (*Cli) GetAccountEffectivePrefs

func (cli *Cli) GetAccountEffectivePrefs(account string) (map[string]any, error)

GetAccountEffectivePrefs retrieves the effective Account Preferences.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

Both the explicitly set and the default preferences are included in the result.

Note: All users can use this command to retrieve their own effective Preferences.

This method executes the GETACCOUNTEFFECTIVEPREFS CLI command.

Returns:

  • map[string]any: a dictionary with the effective Account Preferences.
  • error: an error if the command fails.

func (*Cli) GetAccountEffectiveSettings

func (cli *Cli) GetAccountEffectiveSettings(account string) (map[string]any, error)

GetAccountEffectiveSettings retrieves the effective Account settings.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name. The single asterisk (*) symbol can be used to specify the current authenticated Account.

Both the explicitly set and the default Account settings are included in the result.

Note: All users can send this command for their own Accounts.

This method executes the GETACCOUNTEFFECTIVESETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the effective Account settings.
  • error: an error if the command fails.

func (*Cli) GetAccountInfo

func (cli *Cli) GetAccountInfo(account string, keys []string) (map[string]any, error)

GetAccountInfo retrieves multiple elements from the Account "info" dictionary.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name. The single asterisk (*) symbol can be used to specify the current authenticated Account.
  • keys: an optional slice of info key names to retrieve (e.g., "LastLogin", "LastAddress"). If empty, the entire "info" dictionary is returned.

Note: Key names are case-sensitive. If Account "info" data is stored in .info dictionary files, do NOT include the hash (#) symbol in the key names.

Note: All users can use this command to retrieve elements from their own Account "info" data.

This method executes the GETACCOUNTINFO CLI command.

Returns:

  • map[string]any: a dictionary with the requested info elements.
  • error: an error if the command fails.

func (*Cli) GetAccountLists

func (cli *Cli) GetAccountLists(account string) (map[string]int, error)

GetAccountLists retrieves the list of all mailing lists belonging to the specified Account.

Parameters:

  • account: the list's owner Account name.

This method executes the GETACCOUNTLISTS CLI command.

Returns:

  • map[string]int: a dictionary where each key is the name of a mailing list and the value is the number of subscribers.
  • error: an error if the command fails.

func (*Cli) GetAccountLocation

func (cli *Cli) GetAccountLocation(account string) (string, error)

GetAccountLocation retrieves the storage path for an Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

The path is relative to the file directory of the Account Domain. For multi-mailbox Accounts it points to the Account file directory; for single-mailbox Accounts it points to the INBOX Mailbox path.

This method executes the GETACCOUNTLOCATION CLI command.

Returns:

  • string: the Account file path.
  • error: an error if the command fails.

func (*Cli) GetAccountMailRules

func (cli *Cli) GetAccountMailRules(account string) ([]MailRule, error)

GetAccountMailRules retrieves the list of Account Queue Mail Rules.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

This method executes the GETACCOUNTMAILRULES CLI command.

Returns:

  • []MailRule: a slice of MailRule structures.
  • error: an error if the command fails.

func (*Cli) GetAccountOneInfo

func (cli *Cli) GetAccountOneInfo(account, key string) (any, error)

GetAccountOneInfo retrieves a single element from the Account "info" dictionary.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name. The single asterisk (*) symbol can be used to specify the current authenticated Account.
  • key: the name of the requested "info" element. The key name is case-sensitive. Do NOT include the hash (#) symbol.

If the element is not found, the output is an empty string.

Note: All users can use this command to retrieve elements from their own Account "info" data.

This method executes the GETACCOUNTINFO CLI command with the Key keyword.

Returns:

  • any: the specified info element.
  • error: an error if the command fails.

func (*Cli) GetAccountOneSetting

func (cli *Cli) GetAccountOneSetting(account, key string) (any, error)

GetAccountOneSetting retrieves a single setting from the effective Account settings list.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name. The single asterisk (*) symbol can be used to specify the current authenticated Account.
  • key: the name of the setting to read.

The command produces an object which can be a string, an array, a dictionary, or a null-object representing the requested setting.

Note: All users can send the GETACCOUNTONESETTING command for their own Accounts.

This method executes the GETACCOUNTONESETTING CLI command.

Returns:

  • any: the setting value (string, array, dictionary, or nil).
  • error: an error if the command fails.

func (*Cli) GetAccountPlainPassword

func (cli *Cli) GetAccountPlainPassword(account string, method string) (string, error)

GetAccountPlainPassword retrieves the clear-text password for an Account.

Parameters:

  • account: the name of an existing Account.
  • method: an optional authentication method. Supported values are "SIP" and "RADIUS". If empty, the main Account password is retrieved.

Note: This command only works if the password is stored using a reversible encryption method. It will not return the plain-text password if a non-reversible hash algorithm is used for storage.

This method executes the GETACCOUNTPLAINPASSWORD CLI command.

Returns:

  • string: the plain-text password.
  • error: an error if the command fails.

func (*Cli) GetAccountPrefs

func (cli *Cli) GetAccountPrefs(account string) (map[string]any, error)

GetAccountPrefs retrieves the Account Preferences.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

Only the explicitly set (non-default) preferences are included in the result. To get the combined set of explicit and default preferences, use GetAccountEffectivePrefs instead.

Note: All users can use the GETACCOUNTPREFS command to retrieve their own Account Preferences.

This method executes the GETACCOUNTPREFS CLI command.

Returns:

  • map[string]any: a dictionary with the Account Preferences.
  • error: an error if the command fails.

func (*Cli) GetAccountPresence

func (cli *Cli) GetAccountPresence(account string) (any, error)

GetAccountPresence retrieves the current "presence" status of an Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

The method returns the presence information in one of the following formats:

  • []any (array of two strings): the first element is the presence status (e.g., "Available", "Away"), and the second is the custom status message.
  • string: the presence status (returned if no custom status message is set).
  • nil: returned if the presence status is not set at all.

This method executes the GETACCOUNTPRESENCE CLI command.

Returns:

  • any: the presence data.
  • error: an error if the command fails.

func (*Cli) GetAccountRIMAPs

func (cli *Cli) GetAccountRIMAPs(account string) (map[string]any, error)

GetAccountRIMAPs retrieves the list of Account RIMAP (Remote IMAP) records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

RIMAP records are used to poll external mailboxes and fetch messages into the local Account.

This method executes the GETACCOUNTRIMAPS CLI command.

Returns:

  • map[string]any: a dictionary containing the RIMAP records.
  • error: an error if the command fails.

func (*Cli) GetAccountRPOPs

func (cli *Cli) GetAccountRPOPs(account string) (map[string]any, error)

GetAccountRPOPs retrieves the list of Account RPOP (Remote POP) records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

RPOP records are used to collect mail from external POP3 servers into the local Account.

This method executes the GETACCOUNTRPOPS CLI command.

Returns:

  • map[string]any: a dictionary containing the RPOP records.
  • error: an error if the command fails.

func (*Cli) GetAccountRSIPs

func (cli *Cli) GetAccountRSIPs(account string) (map[string]any, error)

GetAccountRSIPs retrieves the list of Account RSIP (Remote SIP) records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

RSIP records are used for registering on remote SIP servers or managing remote SIP-related configurations for the Account.

This method executes the GETACCOUNTRSIPS CLI command.

Returns:

  • map[string]any: a dictionary containing the RSIP records.
  • error: an error if the command fails.

func (*Cli) GetAccountRights

func (cli *Cli) GetAccountRights(account string) ([]string, error)

GetAccountRights retrieves the access rights granted to the specified Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

The method produces an array listing all Account Server or Domain Access rights. These rights determine what administrative or service-level actions the user is permitted to perform within the server or their domain.

This method executes the GETACCOUNTRIGHTS CLI command.

Returns:

  • []string: a slice of access right strings.
  • error: an error if the command fails.

func (*Cli) GetAccountSettings

func (cli *Cli) GetAccountSettings(account string) (map[string]any, error)

GetAccountSettings retrieves the explicitly set Account settings.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name. The single asterisk (*) symbol can be used to specify the current authenticated Account.

Only the explicitly set (non-default) settings are included in the result. To get the combined set of explicit and default settings, use GetAccountEffectiveSettings instead.

Note: All users can send the GETACCOUNTSETTINGS command for their own Accounts.

This method executes the GETACCOUNTSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Account settings.
  • error: an error if the command fails.

func (*Cli) GetAccountSignalRules

func (cli *Cli) GetAccountSignalRules(account string) ([]SignalRule, error)

GetAccountSignalRules retrieves the list of Account Signal Rules.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

Signal Rules are used to manage real-time communication events.

This method executes the GETACCOUNTSIGNALRULES CLI command.

Returns:

  • []SignalRule: a slice of SignalRule structures.
  • error: an error if the command fails.

func (*Cli) GetAccountStat

func (cli *Cli) GetAccountStat(account string, key string) (any, error)

GetAccountStat retrieves statistics data about the specified Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • key: an optional the name of the statistical entry to retrieve.

This method executes the GETACCOUNTSTAT CLI command.

Returns:

  • any: a number or a timeStamp with the specified statistical information, or (if the key is not specified) a dictionary with all available statistical data. If the statistical data for the specified key does not exist, an empty string is returned.
  • error: an error if the command fails.

func (*Cli) GetAccountTelnums

func (cli *Cli) GetAccountTelnums(account string) ([]string, error)

GetAccountTelnums retrieves the list of telephone numbers assigned to the Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

These numbers are used for telephony services such as PBX routing or SMS.

This method executes the GETACCOUNTTELNUMS CLI command.

Returns:

  • []string: a slice of telephone number strings.
  • error: an error if the command fails.

func (*Cli) GetAccountTemplate

func (cli *Cli) GetAccountTemplate(domain string) (map[string]any, error)

GetAccountTemplate retrieves the Account Template settings for the Domain.

Parameters:

  • domain: an optional Domain name. If empty, applies to the administrator Domain.

This method executes the GETACCOUNTTEMPLATE CLI command.

Returns:

  • map[string]any: a dictionary with the Template settings.
  • error: an error if the command fails.

func (*Cli) GetBanned

func (cli *Cli) GetBanned() (*BannedLines, error)

GetBanned retrieves the server-wide Banned Message Lines settings.

This method executes the GETBANNED CLI command.

Returns:

  • *BannedLines: a structure containing banned body and header lines.
  • error: an error if the command fails.

func (*Cli) GetBlacklistedIPs

func (cli *Cli) GetBlacklistedIPs() (IPList, error)

GetBlacklistedIPs retrieves the server-wide Blacklisted IP Addresses.

This method executes the GETBLACKLISTEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClientIPs

func (cli *Cli) GetClientIPs() (IPList, error)

GetClientIPs retrieves the server-wide Client (trusted) IP Addresses.

This method executes the GETCLIENTIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterAccountDefaults

func (cli *Cli) GetClusterAccountDefaults() (map[string]any, error)

GetClusterAccountDefaults retrieves the cluster-wide Default Account settings.

This method executes the GETCLUSTERACCOUNTDEFAULTS CLI command.

Returns:

  • map[string]any: a dictionary with the cluster default Account settings.
  • error: an error if the command fails.

func (*Cli) GetClusterAccountPrefs

func (cli *Cli) GetClusterAccountPrefs() (map[string]any, error)

GetClusterAccountPrefs retrieves the cluster-wide Default Account Preferences.

This method executes the GETCLUSTERACCOUNTPREFS CLI command.

Returns:

  • map[string]any: a dictionary with the cluster default Preferences.
  • error: an error if the command fails.

func (*Cli) GetClusterAlerts

func (cli *Cli) GetClusterAlerts() (map[string]string, error)

GetClusterAlerts retrieves the cluster-wide Alerts.

This method executes the GETCLUSTERALERTS CLI command.

Returns a map[string]string containing the cluster alerts and timestamps, or an error if the server fails to execute the command.

This method executes the GETCLUSTERALERTS CLI command.

func (*Cli) GetClusterBanned

func (cli *Cli) GetClusterBanned() (*BannedLines, error)

GetClusterBanned retrieves the Cluster-wide Banned Message Lines settings.

This method executes the GETCLUSTERBANNED CLI command.

Returns:

  • *BannedLines: a structure containing banned body and header lines.
  • error: an error if the command fails.

func (*Cli) GetClusterBlacklistedIPs

func (cli *Cli) GetClusterBlacklistedIPs() (IPList, error)

GetClusterBlacklistedIPs retrieves the Cluster-wide Blacklisted IP Addresses.

This method executes the GETCLUSTERBLACKLISTEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterClientIPs

func (cli *Cli) GetClusterClientIPs() (IPList, error)

GetClusterClientIPs retrieves the Cluster-wide Client IP Addresses.

This method executes the GETCLUSTERCLIENTIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterDebugIPs

func (cli *Cli) GetClusterDebugIPs() (IPList, error)

GetClusterDebugIPs retrieves the Cluster-wide Debug IP Addresses.

This method executes the GETCLUSTERDEBUGIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterDeniedIPs

func (cli *Cli) GetClusterDeniedIPs() (IPList, error)

GetClusterDeniedIPs retrieves the Cluster-wide Denied IP Addresses.

This method executes the GETCLUSTERDENIEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterDirectoryIntegration

func (cli *Cli) GetClusterDirectoryIntegration() (map[string]any, error)

GetClusterDirectoryIntegration retrieves the cluster-wide Directory Integration settings.

This method executes the GETCLUSTERDIRECTORYINTEGRATION CLI command.

Returns:

  • map[string]any: a dictionary with the cluster Directory Integration settings.
  • error: an error if the command fails.

func (*Cli) GetClusterDomainDefaults

func (cli *Cli) GetClusterDomainDefaults() (map[string]any, error)

GetClusterDomainDefaults retrieves the cluster-wide default Domain Settings.

This method executes the GETCLUSTERDOMAINDEFAULTS CLI command.

Returns:

  • map[string]any: a dictionary with the cluster-wide default Domain Settings.
  • error: an error if the command fails.

func (*Cli) GetClusterIntercept

func (cli *Cli) GetClusterIntercept() (map[string]any, error)

GetClusterIntercept reads the Cluster-wide Lawful Intercept settings.

This method executes the GETCLUSTERINTERCEPT CLI command.

Returns:

  • map[string]any: a dictionary with the Intercept settings.
  • error: an error if the command fails.

func (*Cli) GetClusterLANIPs

func (cli *Cli) GetClusterLANIPs() (IPList, error)

GetClusterLANIPs retrieves the Cluster-wide LAN IP Addresses.

This method executes the GETCLUSTERLANIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterMailRules

func (cli *Cli) GetClusterMailRules() ([]MailRule, error)

GetClusterMailRules reads the Cluster-wide Automated Mail Processing Rules.

This method executes the GETCLUSTERMAILRULES CLI command.

Returns:

  • []MailRule: a slice of Cluster Queue Rules.
  • error: an error if the command fails.

func (*Cli) GetClusterNatSiteIPs

func (cli *Cli) GetClusterNatSiteIPs() (IPList, error)

GetClusterNatSiteIPs retrieves the Cluster-wide NAT Site IP Addresses.

This method executes the GETCLUSTERNATSITEIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterNatedIPs

func (cli *Cli) GetClusterNatedIPs() (IPList, error)

GetClusterNatedIPs retrieves the Cluster-wide NATed IP Addresses.

This method executes the GETCLUSTERNATEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetClusterNetwork

func (cli *Cli) GetClusterNetwork() (map[string]any, error)

GetClusterNetwork retrieves the Cluster-wide Network settings.

This method executes the GETCLUSTERNETWORK CLI command.

Returns:

  • map[string]any: a dictionary with the network settings.
  • error: an error if the command fails.

func (*Cli) GetClusterRouterSettings

func (cli *Cli) GetClusterRouterSettings() (map[string]any, error)

GetClusterRouterSettings reads the Cluster-wide Router settings.

This method executes the GETCLUSTERROUTERSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Router settings.
  • error: an error if the command fails.

func (*Cli) GetClusterRouterTable

func (cli *Cli) GetClusterRouterTable() (RouterList, error)

GetClusterRouterTable reads the Cluster-wide Router Table.

This method executes the GETCLUSTERROUTERTABLE CLI command.

Returns:

  • RouterList: a parsed list of routing rules.
  • error: an error if the command fails.

func (*Cli) GetClusterSettings

func (cli *Cli) GetClusterSettings() (map[string]any, error)

GetClusterSettings retrieves the Cluster-wide settings.

This method executes the GETCLUSTERSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Cluster settings.
  • error: an error if the command fails.

func (*Cli) GetClusterSignalRules

func (cli *Cli) GetClusterSignalRules() ([]SignalRule, error)

GetClusterSignalRules reads the Cluster-wide Automated Signal Processing Rules.

This method executes the GETCLUSTERSIGNALRULES CLI command.

Returns:

  • []SignalRule: a slice of Cluster Signal Rules.
  • error: an error if the command fails.

func (*Cli) GetClusterTrustedCerts

func (cli *Cli) GetClusterTrustedCerts() ([]string, error)

GetClusterTrustedCerts retrieves the cluster-wide set of Trusted Certificates.

This method executes the GETCLUSTERTRUSTEDCERTS CLI command.

Returns:

  • []string: a slice of Base64-encoded X.509 certificate data.
  • error: an error if the command fails.

func (*Cli) GetClusterWhiteHoleIPs

func (cli *Cli) GetClusterWhiteHoleIPs() (IPList, error)

GetClusterWhiteHoleIPs retrieves the Cluster-wide WhiteHole IP Addresses.

This method executes the GETCLUSTERWHITEHOLEIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetCurrentController

func (cli *Cli) GetCurrentController() (net.IP, error)

GetCurrentController retrieves the IP address of the current Dynamic Cluster Controller.

This method executes the GETCURRENTCONTROLLER CLI command.

Returns:

  • net.IP: the Cluster Controller IP Address.
  • error: an error if the command fails.

func (*Cli) GetCurrentTime

func (cli *Cli) GetCurrentTime() (time.Time, error)

GetCurrentTime retrieves the current internal timer value of the CommuniGate Pro Server.

This method executes the GETCURRENTTIME CLI command.

Returns:

  • time.Time: a timestamp with the Server internal timer value.
  • error: an error if the command fails.

func (*Cli) GetDNRSettings

func (cli *Cli) GetDNRSettings() (map[string]any, error)

GetDNRSettings retrieves the DNR (Domain Name Resolver) settings.

This method executes the GETDNRSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the DNR settings.
  • error: an error if the command fails.

func (*Cli) GetDebugIPs

func (cli *Cli) GetDebugIPs() (IPList, error)

GetDebugIPs retrieves the server-wide Debug IP Addresses.

This method executes the GETDEBUGIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetDeniedIPs

func (cli *Cli) GetDeniedIPs() (IPList, error)

GetDeniedIPs retrieves the server-wide Denied IP Addresses.

This method executes the GETDENIEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetDialogInfo

func (cli *Cli) GetDialogInfo(dialogID int64) (map[string]any, error)

GetDialogInfo retrieves the information about a Signal Dialog object.

Parameters:

  • dialogID: the numeric Dialog ID.

This method executes the GETDIALOGINFO CLI command.

Returns:

  • map[string]any: a dictionary with the Dialog status data.
  • error: an error if the command fails.

func (*Cli) GetDirectoryAccessRights

func (cli *Cli) GetDirectoryAccessRights(shared bool) ([]DirAccessRight, error)

GetDirectoryAccessRights retrieves the Directory Access Rights.

Parameters:

  • shared: if true, the cluster-wide Access Rights are retrieved.

This method executes the GETDIRECTORYACCESSRIGHTS CLI command.

Returns:

  • []DirAccessRight: a slice of Access Rights rules.
  • error: an error if the command fails.

func (*Cli) GetDirectoryIntegration

func (cli *Cli) GetDirectoryIntegration() (map[string]any, error)

GetDirectoryIntegration retrieves the server-wide Directory Integration settings.

This method executes the GETDIRECTORYINTEGRATION CLI command.

Returns:

  • map[string]any: a dictionary with the Directory Integration settings.
  • error: an error if the command fails.

func (*Cli) GetDirectoryUnit

func (cli *Cli) GetDirectoryUnit(unit string, shared bool) (map[string]any, error)

GetDirectoryUnit retrieves the settings for a specific Directory Unit.

Parameters:

  • unit: the Directory Unit name.
  • shared: if true, this is a cluster-wide Directory Unit name.

This method executes the GETDIRECTORYUNIT CLI command.

Returns:

  • map[string]any: a dictionary with the Directory Unit settings.
  • error: an error if the command fails.

func (*Cli) GetDomainAlerts

func (cli *Cli) GetDomainAlerts(domain string) (map[string]string, error)

GetDomainAlerts retrieves the domain-wide Alerts.

Parameters:

  • domain: an optional name of an existing Domain. If an empty string is provided, the command typically targets the current domain context.

This method executes the GETDOMAINALERTS CLI command.

Returns a map[string]string containing the domain alerts and timestamps, or an error if the server fails to execute the command.

This method executes the GETDOMAINALERTS CLI command.

func (*Cli) GetDomainAliases

func (cli *Cli) GetDomainAliases(domain string) ([]string, error)

GetDomainAliases retrieves the list of Domain Aliases.

Parameters:

  • domain: the name of an existing Domain.

This method executes the GETDOMAINALIASES CLI command.

Returns:

  • []string: an array with the Domain alias names.
  • error: an error if the command fails.

func (*Cli) GetDomainDefaults

func (cli *Cli) GetDomainDefaults() (map[string]any, error)

GetDomainDefaults retrieves the server-wide default Domain Settings.

This method executes the GETDOMAINDEFAULTS CLI command.

Returns:

  • map[string]any: a dictionary with the default Domain Settings.
  • error: an error if the command fails.

func (*Cli) GetDomainEffectiveSettings

func (cli *Cli) GetDomainEffectiveSettings(domain string) (map[string]any, error)

GetDomainEffectiveSettings retrieves both explicitly set and default Domain settings.

Parameters:

  • domain: the name of an existing Domain. If empty, uses the current context.

This method executes the GETDOMAINEFFECTIVESETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with all domain settings (explicit + default).
  • error: an error if the command fails.

func (*Cli) GetDomainLists

func (cli *Cli) GetDomainLists(domain string) (map[string]int, error)

GetDomainLists retrieves the list of all mailing lists in the Domain.

Parameters:

  • domain: an optional Domain name.

This method executes the GETDOMAINLISTS CLI command.

Returns:

  • map[string]int: a dictionary where each key is the name of a mailing list and the value is the number of subscribers.
  • error: an error if the command fails.

func (*Cli) GetDomainLocation

func (cli *Cli) GetDomainLocation(domain string) (string, error)

GetDomainLocation retrieves the Domain file directory path relative to the Server base.

Parameters:

  • domain: the Domain name. If empty, applies to the administrator Domain.

This method executes the GETDOMAINLOCATION CLI command.

Returns:

  • string: the Domain file path.
  • error: an error if the command fails.

func (*Cli) GetDomainMailRules

func (cli *Cli) GetDomainMailRules(domain string) ([]MailRule, error)

GetDomainMailRules retrieves the list of Domain Queue Mail Rules.

Parameters:

  • domain: the name of an existing Domain.

This method executes the GETDOMAINMAILRULES CLI command.

Returns:

  • []MailRule: an array of the Mail Rules specified for the Domain.
  • error: an error if the command fails.

func (*Cli) GetDomainSettings

func (cli *Cli) GetDomainSettings(domain string) (map[string]any, error)

GetDomainSettings retrieves explicitly set (non-default) Domain settings.

Parameters:

  • domain: the name of an existing Domain. If empty, uses the current context.

This method executes the GETDOMAINSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary containing only explicitly set settings.
  • error: an error if the command fails.

func (*Cli) GetDomainSignalRules

func (cli *Cli) GetDomainSignalRules(domain string) ([]SignalRule, error)

GetDomainSignalRules retrieves the list of Domain Signal Rules.

Parameters:

  • domain: the name of an existing Domain.

This method executes the GETDOMAINSIGNALRULES CLI command.

Returns:

  • []SignalRule: an array of the Signal Rules specified for the Domain.
  • error: an error if the command fails.

func (*Cli) GetDomainStat

func (cli *Cli) GetDomainStat(domain string, key string) (any, error)

GetDomainStat retrieves statistics data about the specified Domain.

Parameters:

  • domain: the name of an existing Domain. The asterisk (*) symbol can be used to specify the Domain of the current authenticated Account.
  • key: an optional the name of the statistical entry to retrieve.

This method executes the GETDOMAINSTAT CLI command.

Returns:

  • any: a string with the specified statistical information, or (if the key is not specified) a dictionary with all available statistical data.
  • error: an error if the command fails.

func (*Cli) GetFileSubscription

func (cli *Cli) GetFileSubscription(account string) ([]string, error)

GetFileSubscription retrieves the list of Account "subscribed files".

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.

This method executes the GETFILESUBSCRIPTION CLI command.

Returns:

  • []string: an array containing the list of subscribed file names.
  • error: an error if the command fails.

func (*Cli) GetForwarder

func (cli *Cli) GetForwarder(forwarder string) (string, error)

GetForwarder retrieves the Forwarder address.

Parameters:

  • forwarder: the name of an existing Forwarder. The name can include the Domain name.

This method executes the GETFORWARDER CLI command.

Returns:

  • string: a string with the E-mail address this Forwarder reroutes all E-mail messages and Signals to.
  • error: an error if the command fails.

func (*Cli) GetGroup

func (cli *Cli) GetGroup(group string) (*GroupResult, error)

GetGroup retrieves the Group settings.

Parameters:

  • group: the name of an existing Group. The name can include the Domain name.

This method executes the GETGROUP CLI command.

Returns:

  • *GroupResult: a structure containing the Group settings and members.
  • error: an error if the command fails.

func (*Cli) GetIPState

func (cli *Cli) GetIPState(ip string, temp bool) (string, error)

GetIPState retrieves the type assigned to the specified IP address.

Parameters:

  • ip: the IP address to check.
  • temp: if true, the temporary Client IP Addresses set is checked.

This method executes the GETIPSTATE CLI command.

Returns:

  • string: the IP address type.
  • error: an error if the command fails.

func (*Cli) GetLANIPs

func (cli *Cli) GetLANIPs() (IPList, error)

GetLANIPs retrieves the set of LAN IP Addresses.

This method executes the GETLANIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetList

func (cli *Cli) GetList(list string) (map[string]any, error)

GetList retrieves list settings.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.

This method executes the GETLIST CLI command.

Returns:

  • map[string]any: a dictionary with the mailing list settings.
  • error: an error if the command fails.

func (*Cli) GetLogSettings

func (cli *Cli) GetLogSettings() (map[string]any, error)

GetLogSettings retrieves the Main Log settings.

This method executes the GETLOGSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Main Log settings.
  • error: an error if the command fails.

func (*Cli) GetMailboxACL

func (cli *Cli) GetMailboxACL(account, mailbox, authAccount string) (map[string]string, error)

GetMailboxACL retrieves the access control list for the Account Mailbox.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of an existing Mailbox in the specified Account.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the GETMAILBOXACL CLI command.

Returns:

  • map[string]string: a dictionary with the Mailbox access elements.
  • error: an error if the command fails.

func (*Cli) GetMailboxAliases

func (cli *Cli) GetMailboxAliases(account string) (map[string]string, error)

GetMailboxAliases retrieves the Account Mailbox aliases.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.

This method executes the GETMAILBOXALIASES CLI command.

Returns:

  • map[string]string: a dictionary where each key is the name of an existing Mailbox alias, and the value is the name of the Mailbox it points to.
  • error: an error if the command fails.

func (*Cli) GetMailboxInfo

func (cli *Cli) GetMailboxInfo(account, mailbox, authAccount string) (map[string]any, error)

GetMailboxInfo retrieves the internal information about the Account Mailbox.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of an existing Mailbox in the specified Account.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the GETMAILBOXINFO CLI command.

Returns:

  • map[string]any: a dictionary with the Mailbox internal information.
  • error: an error if the command fails.

func (*Cli) GetMailboxRights

func (cli *Cli) GetMailboxRights(account, mailbox, authAccount string) (string, error)

GetMailboxRights retrieves the effective Mailbox access rights based on the Mailbox ACL for the given authAccountName.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of an existing Mailbox in the specified Account.
  • authAccount: the name of an Account whose access rights should be retrieved.

This method executes the GETMAILBOXRIGHTS CLI command.

Returns:

  • string: a string with the effective Mailbox access rights.
  • error: an error if the command fails.

func (*Cli) GetMailboxSubscription

func (cli *Cli) GetMailboxSubscription(account string) ([]string, error)

GetMailboxSubscription retrieves the list of Account "subscribed Mailboxes".

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.

This method executes the GETMAILBOXSUBSCRIPTION CLI command.

Returns:

  • []string: an array with the list of Account "subscribed Mailboxes".
  • error: an error if the command fails.

func (*Cli) GetMediaServerSettings

func (cli *Cli) GetMediaServerSettings() (map[string]any, error)

GetMediaServerSettings reads the Media Server component settings.

This method executes the GETMEDIASERVERSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the component settings.
  • error: an error if the command fails.

func (*Cli) GetMessageQueueInfo

func (cli *Cli) GetMessageQueueInfo(module, queue string) (map[string]any, error)

GetMessageQueueInfo reads information about a module message Queue.

Parameters:

  • module: the module name.
  • queue: the module queue name.

This method executes the GETMESSAGEQUEUEINFO CLI command.

Returns:

  • map[string]any: a dictionary with the specified queue information (nTotal, size, delayedTill, lastError).
  • error: an error if the command fails.

func (*Cli) GetModule

func (cli *Cli) GetModule(name string) (map[string]any, error)

GetModule retrieves settings for a specific Server module.

Parameters:

  • name: the name of a CommuniGate Pro Server module.

This method executes the GETMODULE CLI command.

Returns:

  • map[string]any: a dictionary with the module settings.
  • error: an error if the command fails.

func (*Cli) GetNamedTask

func (cli *Cli) GetNamedTask(task string) (map[string]any, error)

GetNamedTask retrieves the Named Task settings.

Parameters:

  • task: the name of an existing Named Task. The name can include the Domain name.

This method executes the GETNAMEDTASK CLI command.

Returns:

  • map[string]any: a dictionary with the Named Task settings.
  • error: an error if the command fails.

func (*Cli) GetNatSiteIPs

func (cli *Cli) GetNatSiteIPs() (IPList, error)

GetNatSiteIPs retrieves the server-wide NAT Site IP Addresses.

This method executes the GETNATSITEIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetNatedIPs

func (cli *Cli) GetNatedIPs() (IPList, error)

GetNatedIPs retrieves the server-wide NATed IP Addresses.

This method executes the GETNATEDIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) GetNetwork

func (cli *Cli) GetNetwork() (map[string]any, error)

GetNetwork retrieves the Server Network settings.

This method executes the GETNETWORK CLI command.

Returns:

  • map[string]any: a dictionary with the server network settings.
  • error: an error if the command fails.

func (*Cli) GetNextStatName

func (cli *Cli) GetNextStatName(objectID string) (string, error)

GetNextStatName is used to enumerate available Server statistics (SNMP) elements.

Parameters:

  • objectID: an empty string to get the first element, or the ID of the previously found element.

This method executes the GETNEXTSTATNAME CLI command.

Returns:

  • string: the ObjectID of the next statistics element.
  • error: returns io.EOF if the current element is the last one available.

func (*Cli) GetQueueSettings

func (cli *Cli) GetQueueSettings() (map[string]any, error)

GetQueueSettings retrieves the Queue settings.

This method executes the GETQUEUESETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Queue settings.
  • error: an error if the command fails.

func (*Cli) GetRespCode

func (cli *Cli) GetRespCode() CliCode

GetRespCode returns the numeric status code from the last server response.

Returns:

  • CliCode: a numeric status code (e.g., 200 for OK, 201 for OK INLINE).

func (*Cli) GetRespData

func (cli *Cli) GetRespData() string

GetRespData returns the raw string data (payload) from the last server response.

Returns:

  • string: the data portion of the CLI response, following the status code.

func (*Cli) GetRouterSettings

func (cli *Cli) GetRouterSettings() (map[string]any, error)

GetRouterSettings reads the Router settings.

This method executes the GETROUTERSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Router settings.
  • error: an error if the command fails.

func (*Cli) GetRouterTable

func (cli *Cli) GetRouterTable() (RouterList, error)

GetRouterTable reads the Router Table.

This method executes the GETROUTERTABLE CLI command.

Returns:

  • RouterList: a parsed list of routing rules.
  • error: an error if the command fails.

func (*Cli) GetSMTPSendProfiles

func (cli *Cli) GetSMTPSendProfiles() (map[string]any, error)

GetSMTPSendProfiles retrieves the Target Host Profiles of the SMTP module.

This method executes the GETSMTPSENDPROFILES CLI command.

Returns:

  • map[string]any: a dictionary containing profile settings.
  • error: an error if the command fails.

func (*Cli) GetServerAccountDefaults

func (cli *Cli) GetServerAccountDefaults() (map[string]any, error)

GetServerAccountDefaults retrieves the server-wide Default Account settings.

This method executes the GETSERVERACCOUNTDEFAULTS CLI command.

Returns:

  • map[string]any: a dictionary with the default Account settings.
  • error: an error if the command fails.

func (*Cli) GetServerAccountPrefs

func (cli *Cli) GetServerAccountPrefs() (map[string]any, error)

GetServerAccountPrefs retrieves the server-wide Default Account Preferences.

This method executes the GETSERVERACCOUNTPREFS CLI command.

Returns:

  • map[string]any: a dictionary with the default Preferences.
  • error: an error if the command fails.

func (*Cli) GetServerAlerts

func (cli *Cli) GetServerAlerts() (map[string]string, error)

GetServerAlerts retrieves the server-wide Alerts.

This method executes the GETSERVERALERTS CLI command.

Returns a map[string]string containing the server alerts and timestamps, or an error if the server fails to execute the command.

This method executes the GETSERVERALERTS CLI command.

func (*Cli) GetServerIntercept

func (cli *Cli) GetServerIntercept() (map[string]any, error)

GetServerIntercept reads the Lawful Intercept settings.

This method executes the GETSERVERINTERCEPT CLI command.

Returns:

  • map[string]any: a dictionary with the Intercept settings.
  • error: an error if the command fails.

func (*Cli) GetServerMailRules

func (cli *Cli) GetServerMailRules() ([]MailRule, error)

GetServerMailRules reads the Server-Wide Automated Mail Processing Rules.

This method executes the GETSERVERMAILRULES CLI command.

Returns:

  • []MailRule: a slice of Server Queue Rules.
  • error: an error if the command fails.

func (*Cli) GetServerSettings

func (cli *Cli) GetServerSettings() (map[string]any, error)

GetServerSettings reads the "other" Server settings.

This method executes the GETSERVERSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Server settings.
  • error: an error if the command fails.

func (*Cli) GetServerSignalRules

func (cli *Cli) GetServerSignalRules() ([]SignalRule, error)

GetServerSignalRules reads the Server-Wide Automated Signal Processing Rules.

This method executes the GETSERVERSIGNALRULES CLI command.

Returns:

  • []SignalRule: a slice of Server Signal Rules.
  • error: an error if the command fails.

func (*Cli) GetServerTrustedCerts

func (cli *Cli) GetServerTrustedCerts() ([]string, error)

GetServerTrustedCerts retrieves the server-wide set of Trusted Certificates.

This method executes the GETSERVERTRUSTEDCERTS CLI command.

Returns:

  • []string: an array of Base64-encoded X.509 certificate data.
  • error: an error if the command fails.

func (*Cli) GetSession

func (cli *Cli) GetSession(sessionID, domain string) (map[string]any, error)

GetSession retrieves Session data.

Parameters:

  • sessionID: the Session ID.
  • domain: an optional the name of Domain the session Account belongs to.

This method executes the GETSESSION CLI command.

Returns:

  • map[string]any: a dictionary with the session dataset.
  • error: an error if the command fails.

func (*Cli) GetSessionSettings

func (cli *Cli) GetSessionSettings() (map[string]any, error)

GetSessionSettings retrieves the user Sessions settings.

This method executes the GETSESSIONSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the Sessions settings.
  • error: an error if the command fails.

func (*Cli) GetSignalSettings

func (cli *Cli) GetSignalSettings() (map[string]any, error)

GetSignalSettings retrieves the Signal component settings.

This method executes the GETSIGNALSETTINGS CLI command.

Returns:

  • map[string]any: a dictionary with the component settings.
  • error: an error if the command fails.

func (*Cli) GetStatElement

func (cli *Cli) GetStatElement(objectID string) (any, error)

GetStatElement retrieves the current value of a Server statistics (SNMP) element.

Parameters:

  • objectID: the object ID of the Server statistics element.

This method executes the GETSTATELEMENT CLI command.

Returns:

  • any: a number, string, or other object representing the element value.
  • error: an error if the command fails.

func (*Cli) GetStorageFileInfo

func (cli *Cli) GetStorageFileInfo(account, path, authAccount string) (*StorageFileInfo, error)

GetStorageFileInfo retrieves statistical information about all files in the Account File Storage.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • path: an optional name of the File Storage subdirectory.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the GETSTORAGEFILEINFO CLI command.

Returns:

  • *StorageFileInfo: a structure with total size and file count.
  • error: an error if the command fails.

func (*Cli) GetSubscriberInfo

func (cli *Cli) GetSubscriberInfo(list, subscriber string) (*SubscriberInfo, error)

GetSubscriberInfo retrieves information about a list subscriber.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • subscriber: the E-mail address of the list subscriber.

This method executes the GETSUBSCRIBERINFO CLI command.

Returns:

  • *SubscriberInfo: a structure with subscriber information.
  • error: an error if the command fails.

func (*Cli) GetSystemInfo

func (cli *Cli) GetSystemInfo(what SystemInfoKey) (any, error)

GetSystemInfo retrieves information returned by the CG/PL SystemInfo function called with the what parameter.

Parameters:

  • what: the system information key to retrieve.

This method executes the GETSYSTEMINFO CLI command.

Returns:

  • any: an object returned by the SystemInfo function.
  • error: an error if the command fails.

func (*Cli) GetTempBlacklistedIPs

func (cli *Cli) GetTempBlacklistedIPs() (*TempIPList, error)

GetTempBlacklistedIPs retrieves the set of Temporarily Blocked Addresses.

This method executes the GETTEMPBLACKLISTEDIPS CLI command.

Returns:

  • *TempIPList: a list of Temporary Blocked IP addresses. Each address may have a suffix indicating the block duration.
  • error: an error if the command fails.

func (*Cli) GetTempClientIPs

func (cli *Cli) GetTempClientIPs() (*TempIPList, error)

GetTempClientIPs retrieves the set of temporary Client IP Addresses.

This method executes the GETTEMPCLIENTIPS CLI command.

Returns:

  • *TempIPList: a list of Temporary Client IP addresses.
  • error: an error if the command fails.

func (*Cli) GetTempUnblockableIPs

func (cli *Cli) GetTempUnblockableIPs() (*TempIPList, error)

GetTempUnblockableIPs retrieves the set of Temporary UnBlockable IP Addresses.

This method executes the GETTEMPUNBLOCKABLEIPS CLI command.

Returns:

  • *TempIPList: a list of Temporary UnBlockable IP addresses.
  • error: an error if the command fails.

func (*Cli) GetVersion

func (cli *Cli) GetVersion() (string, error)

GetVersion retrieves the current CommuniGate Pro Server version.

This method executes the GETVERSION CLI command.

Returns:

  • string: a string with the server version.
  • error: an error if the command fails.

func (*Cli) GetWhiteHoleIPs

func (cli *Cli) GetWhiteHoleIPs() (IPList, error)

GetWhiteHoleIPs retrieves the server-wide WhiteHole IP Addresses.

This method executes the GETWHITEHOLEIPS CLI command.

Returns:

  • IPList: a parsed list of IP addresses and ranges.
  • error: an error if the command fails.

func (*Cli) InsertDirectoryRecords

func (cli *Cli) InsertDirectoryRecords(domain string) error

InsertDirectoryRecords inserts records for Domain objects into the Directory.

Parameters:

  • domain: the Domain name. If empty, applies to the authenticated user Domain.

This method executes the INSERTDIRECTORYRECORDS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) IsAccountExists

func (cli *Cli) IsAccountExists(account string) (bool, error)

IsAccountExists checks for the existence of an account on the server.

Parameters:

  • account: the name of the account to check. The name can include the Domain name.

This is a helper method that does not correspond to a single CLI command. It internally calls GetAccountLocation to verify existence. If the account exists, the server returns its storage path; otherwise, it returns an error.

Returns:

  • (true, nil) if the account is found.
  • (false, nil) if the account is confirmed to not exist.
  • (false, error) if the check fails due to communication or permission issues.

func (*Cli) IsDomainExists

func (cli *Cli) IsDomainExists(domain string) (bool, error)

IsDomainExists checks if a domain exists by attempting to retrieve its location.

Parameters:

  • domain: the name of the domain to check.

Returns:

  • bool: true if the domain exists.
  • error: an error if the command fails.

func (*Cli) IsGroupExists

func (cli *Cli) IsGroupExists(group string) (bool, error)

IsGroupExists checks if a group exists by attempting to retrieve its settings.

Parameters:

  • group: the name of an existing Group. The name can include the Domain name.

This method executes the GETGROUP CLI command.

Returns:

  • bool: true if the group exists.
  • error: an error if the command fails.

func (*Cli) IsSuccess

func (cli *Cli) IsSuccess() bool

IsSuccess returns true if the last response code indicates success (200 or 201).

func (*Cli) KillAccountSessions

func (cli *Cli) KillAccountSessions(account string) error

KillAccountSessions interrupts all active sessions for the specified Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.

This command immediately terminates all active connections and sessions associated with the account, including POP, IMAP, FTP, WebUser, AirSync, and others.

This method executes the KILLACCOUNTSESSIONS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) KillNode

func (cli *Cli) KillNode(taskID string) error

KillNode kills an existing PBX Task.

Parameters:

  • taskID: the unique Task ID.

This method executes the KILLNODE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) KillSession

func (cli *Cli) KillSession(sessionID, domain string) error

KillSession terminates a Session.

Parameters:

  • sessionID: the Session ID.
  • domain: an optional the name of Domain the session Account belongs to.

This method executes the KILLSESSION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) List

func (cli *Cli) List(list, operation, subscriber string, silently, confirm bool) error

List updates the subscribers list.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • operation: the operation (subscribe, feed, digest, index, null, banned, unsubscribe).
  • subscriber: the subscriber address. It can include the comment part used as the subscriber's real name.
  • silently: tells the server not to send the Welcome/Bye message to the subscriber.
  • confirm: tells the server to send a confirmation request to the subscriber.

Returns:

  • error: an error if the command fails.

func (*Cli) ListAccountNamedTasks

func (cli *Cli) ListAccountNamedTasks(account string) (map[string]any, error)

ListAccountNamedTasks retrieves the list of all Named Tasks owned by the specified Account.

Parameters:

  • account: the owner Account name.

This method executes the LISTACCOUNTNAMEDTASKS CLI command.

Returns:

  • map[string]any: a dictionary where keys are Task names and values are dictionaries containing Task owner, Real Name, and Application program.
  • error: an error if the command fails.

func (*Cli) ListAccountSessions

func (cli *Cli) ListAccountSessions(account, addr, origAddr, protocol, transport, client string) ([]string, error)

ListAccountSessions retrieves all existing sessions for the specified Account.

Parameters:

  • account: the Account name.
  • addr: an optional the IP address of the client browser.
  • origAddr: an optional the IP address of the client browser, if this browser is located behind an HTTP proxy.
  • protocol: an optional the Session protocol (WebUser, XIMSS, XMPP, etc.).
  • transport: an optional the Session transport (HTTP, XIMSS, XMPP, etc.).
  • client: an optional the Session client.

This method executes the ADDRESS CLI command.

Returns:

  • []string: an array of Session IDs.
  • error: an error if the command fails.

func (*Cli) ListAccountStorage

func (cli *Cli) ListAccountStorage(domain string) ([]string, error)

ListAccountStorage lists Account "storage mount points" in the specified Domain.

Parameters:

  • domain: the Domain name.

This method executes the LISTACCOUNTSTORAGE CLI command.

Returns:

  • []string: an array with "storage mount points" names.
  • error: an error if the command fails.

func (*Cli) ListAccounts

func (cli *Cli) ListAccounts(domain string) (map[string]string, error)

ListAccounts retrieves the list of all Accounts in the Domain.

Parameters:

  • domain: an optional Domain name. If empty, applies to the administrator Domain.

This method executes the LISTACCOUNTS CLI command.

Returns:

  • map[string]string: a dictionary where keys are Account names.
  • error: an error if the command fails.

func (*Cli) ListAdminDomains

func (cli *Cli) ListAdminDomains(domain string) ([]string, error)

ListAdminDomains gets the list of Domains that can be administered in the target Domain.

Parameters:

  • domain: an optional Domain name. If empty, applies to the authenticated user Domain.

This method executes the LISTADMINDOMAINS CLI command.

Returns:

  • []string: an array with the Domain names.
  • error: an error if the command fails.

func (*Cli) ListAllStats

func (cli *Cli) ListAllStats() ([]string, error)

ListAllStats is a helper method that iterates through the entire statistics tree and returns a slice of all available OIDs.

Returns:

  • []string: a slice containing all discovered statistic names.
  • error: an error if the command fails.

func (*Cli) ListCLICommands

func (cli *Cli) ListCLICommands() ([]string, error)

ListCLICommands retrieves the list of all CLI commands supported by this version of CommuniGate Pro Server.

This method executes the LISTCLICOMMANDS CLI command.

Returns:

  • []string: an array of strings, where each string is a supported command name.
  • error: an error if the command fails.

func (*Cli) ListClusterPBXFiles

func (cli *Cli) ListClusterPBXFiles(language string) (map[string]*FileInfo, error)

ListClusterPBXFiles lists files in the cluster-wide Real-Time Application Environment.

Parameters:

  • language: an optional national subset name.

This method executes the LISTCLUSTERPBXFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with file names as keys.
  • error: an error if the command fails.

func (*Cli) ListClusterSkinFiles

func (cli *Cli) ListClusterSkinFiles(skin string) (map[string]*FileInfo, error)

ListClusterSkinFiles lists files in a custom Cluster Skin.

Parameters:

  • skin: the name of an existing Cluster Skin.

This method executes the LISTCLUSTERSKINFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with Skin file names as keys.
  • error: an error if the command fails.

func (*Cli) ListClusterSkins

func (cli *Cli) ListClusterSkins() ([]string, error)

ListClusterSkins lists custom Cluster Skins.

This method executes the LISTCLUSTERSKINS CLI command.

Returns:

  • []string: an array with Skin names.
  • error: an error if the command fails.

func (*Cli) ListClusterTelnums

func (cli *Cli) ListClusterTelnums(filter string, limit int) (map[string]string, error)

ListClusterTelnums reads Telnum numbers created in shared Cluster Domains.

Parameters:

  • filter: an optional substring filter for telnum numbers.
  • limit: maximum number of Telnum numbers to return.

This method executes the LISTCLUSTERTELNUMS CLI command.

Returns:

  • map[string]string: a dictionary mapping Telnums to Account names.
  • error: an error if the command fails.

func (*Cli) ListDirectoryUnits

func (cli *Cli) ListDirectoryUnits(shared bool) (map[string]string, error)

ListDirectoryUnits retrieves the list of all created Directory units.

Parameters:

  • shared: if true, the cluster-wide Units are listed.

This method executes the LISTDIRECTORYUNITS CLI command.

Returns:

  • map[string]string: a dictionary where keys are Directory Unit mount points and values are Directory Unit names.
  • error: an error if the command fails.

func (*Cli) ListDomainNamedTasks

func (cli *Cli) ListDomainNamedTasks(domain string) (map[string]any, error)

ListDomainNamedTasks retrieves the list of all Named Tasks in the Domain.

Parameters:

  • domain: an optional Domain name. If the Domain name is not specified, the command applies to the administrator Domain.

This method executes the LISTDOMAINNAMEDTASKS CLI command.

Returns:

  • map[string]any: a dictionary where keys are Task names and values are dictionaries containing Task owner, Real Name, and Application program.
  • error: an error if the command fails.

func (*Cli) ListDomainObjects

func (cli *Cli) ListDomainObjects(domain string, limit int, filter string, what ObjectType, cookie string) (*DomainObjectsResult, error)

ListDomainObjects retrieves a paginated and filtered list of Domain objects.

Parameters:

  • domain: the Domain name.
  • limit: the maximum number of objects to list in one batch.
  • filter: an optional substring to filter object names.
  • what: bitmask ObjectType specifying which objects (Accounts, Aliases, Forwarders) to list.
  • cookie: pagination token. Use an empty string for the first request.

This method executes the LISTDOMAINOBJECTS CLI command.

Returns:

  • *DomainObjectsResult: a structure containing the objects found and the next cookie.
  • error: an error if the command fails.

func (*Cli) ListDomainPBXFiles

func (cli *Cli) ListDomainPBXFiles(domain, language string) (map[string]*FileInfo, error)

ListDomainPBXFiles lists files in the Domain Real-Time Application Environment.

Parameters:

  • domain: an optional Domain name. If not specified, the administrator Domain is used.
  • language: an optional national subset name.

This method executes the LISTDOMAINPBXFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with file names as keys.
  • error: an error if the command fails.

func (*Cli) ListDomainSkinFiles

func (cli *Cli) ListDomainSkinFiles(domain, skin string) (map[string]*FileInfo, error)

ListDomainSkinFiles lists files in a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of an existing Domain Skin.

This method executes the LISTDOMAINSKINFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with Skin file names as keys.
  • error: an error if the command fails.

func (*Cli) ListDomainSkins

func (cli *Cli) ListDomainSkins(domain string) ([]string, error)

ListDomainSkins lists custom Domain Skins.

Parameters:

  • domain: an optional the Domain name.

This method executes the LISTDOMAINSKINS CLI command.

Returns:

  • []string: an array with Skin names.
  • error: an error if the command fails.

func (*Cli) ListDomainStorage

func (cli *Cli) ListDomainStorage(shared bool) ([]string, error)

ListDomainStorage retrieves the list of "storage mount points" for Domains.

Parameters:

  • shared: if true, lists mount points for Cluster Domains.

This method executes the LISTDOMAINSTORAGE CLI command.

Returns:

  • []string: an array containing the "storage mount points" names.
  • error: an error if the command fails.

func (*Cli) ListDomainTelnums

func (cli *Cli) ListDomainTelnums(domain, filter string, limit int) (map[string]string, error)

ListDomainTelnums reads Telnum numbers created in the specified Domain.

Parameters:

  • domain: the Domain name.
  • filter: an optional substring to filter telnum numbers.
  • limit: maximum number of numbers to return.

This method executes the LISTDOMAINTELNUMS CLI command.

Returns:

  • map[string]string: a dictionary where each key is a Telnum, and the value is the Account.
  • error: an error if the command fails.

func (*Cli) ListDomains

func (cli *Cli) ListDomains() ([]string, error)

ListDomains retrieves the names of all server domains.

This method executes the LISTDOMAINS CLI command.

Returns:

  • []string: an array with the names of all server domains.
  • error: an error if the command fails.

func (*Cli) ListForwarders

func (cli *Cli) ListForwarders(domain string) ([]string, error)

ListForwarders retrieves the list of all Forwarders in the Domain.

Parameters:

  • domain: an optional Domain name. If not specified, the command applies to the administrator Domain.

This method executes the LISTFORWARDERS CLI command.

Returns:

  • []string: an array with the names of all Forwarders in the specified (or default) Domain.
  • error: an error if the command fails.

func (*Cli) ListGroups

func (cli *Cli) ListGroups(domain string) ([]string, error)

ListGroups retrieves the list of all Groups in the Domain.

Parameters:

  • domain: an optional Domain name. If the Domain name is not specified, the command applies to the administrator Domain.

This method executes the LISTGROUPS CLI command.

Returns:

  • []string: an array with the names of all Groups in the specified (or default) Domain.
  • error: an error if the command fails.

func (*Cli) ListLists

func (cli *Cli) ListLists(domain string) ([]string, error)

ListLists retrieves the list of all mailing lists in the Domain.

Parameters:

  • domain: an optional Domain name.

This method executes the LISTLISTS CLI command.

Returns:

  • []string: an array of strings where each string is the name of a mailing list in the specified (or default) Domain.
  • error: an error if the command fails.

func (*Cli) ListLiteSessions

func (cli *Cli) ListLiteSessions(addr, origAddr string) ([]string, error)

ListLiteSessions retrieves all LITE sessions.

Parameters:

  • addr: an optional the IP address of the client browser.
  • origAddr: an optional the IP address of the client browser, if this browser is located behind an HTTP proxy.

This method executes the ADDRESS CLI command.

Returns:

  • []string: an array of Session IDs.
  • error: an error if the command fails.

func (*Cli) ListMailboxes

func (cli *Cli) ListMailboxes(account, filter, authAccount string) (map[string]any, error)

ListMailboxes retrieves the list of Account Mailboxes.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • filter: an optional filter string for Account Mailbox names (wildcards "*" and "%" are supported).
  • authAccount: an optional name of an Account on whose behalf the LIST operation is executed.

This method executes the LISTMAILBOXES CLI command.

Returns:

  • map[string]any: a dictionary where each key is a Mailbox name and the value contains Mailbox information or nested structures.
  • error: an error if the command fails.

func (*Cli) ListModules

func (cli *Cli) ListModules() ([]string, error)

ListModules lists all Server modules.

This method executes the LISTMODULES CLI command.

Returns:

  • []string: an array with all module names.
  • error: an error if the command fails.

func (*Cli) ListServerPBXFiles

func (cli *Cli) ListServerPBXFiles(language string) (map[string]*FileInfo, error)

ListServerPBXFiles lists files in the Server-wide Real-Time Application Environment.

Parameters:

  • language: an optional national subset name.

This method executes the LISTSERVERPBXFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with file names as keys.
  • error: an error if the command fails.

func (*Cli) ListServerSkinFiles

func (cli *Cli) ListServerSkinFiles(skin string) (map[string]*FileInfo, error)

ListServerSkinFiles lists files in a custom Server Skin.

Parameters:

  • skin: the name of an existing Server Skin.

This method executes the LISTSERVERSKINFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with Skin file names as keys.
  • error: an error if the command fails.

func (*Cli) ListServerSkins

func (cli *Cli) ListServerSkins() ([]string, error)

ListServerSkins lists custom Server Skins.

This method executes the LISTSERVERSKINS CLI command.

Returns:

  • []string: an array with Skin names.
  • error: an error if the command fails.

func (*Cli) ListServerTelnums

func (cli *Cli) ListServerTelnums(filter string, limit int) (map[string]string, error)

ListServerTelnums reads Telnum numbers created in all non-clustered Domains.

Parameters:

  • filter: an optional substring filter for telnum numbers.
  • limit: maximum number of Telnum numbers to return.

This method executes the LISTSERVERTELNUMS CLI command.

Returns:

  • map[string]string: a dictionary mapping Telnums to Account names.
  • error: an error if the command fails.

func (*Cli) ListStockPBXFiles

func (cli *Cli) ListStockPBXFiles(language string) (map[string]*FileInfo, error)

ListStockPBXFiles lists files in the stock (built-in) Real-Time Application Environment.

Parameters:

  • language: an optional national subset name.

This method executes the LISTSTOCKPBXFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with file names as keys.
  • error: an error if the command fails.

func (*Cli) ListStockSkinFiles

func (cli *Cli) ListStockSkinFiles(skin string) (map[string]*FileInfo, error)

ListStockSkinFiles lists files in a built-in (stock) Skin.

Parameters:

  • skin: the name of a built-in Skin.

This method executes the LISTSTOCKSKINFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary with Skin file names as keys.
  • error: an error if the command fails.

func (*Cli) ListStorageFiles

func (cli *Cli) ListStorageFiles(account, path, authAccount string) (map[string]*FileInfo, error)

ListStorageFiles lists all files in the File Storage directory or its subdirectories.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • path: an optional name of the File Storage subdirectory.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the LISTSTORAGEFILES CLI command.

Returns:

  • map[string]*FileInfo: a dictionary where keys are file names and values contain file details.
  • error: an error if the command fails.

func (*Cli) ListSubscribers

func (cli *Cli) ListSubscribers(list, filter string, limit int) ([]string, error)

ListSubscribers retrieves list subscribers.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • filter: an optional substring to filter addresses.
  • limit: limits the number of subscriber addresses returned.

This method executes the LISTSUBSCRIBERS CLI command.

Returns:

  • []string: an array with subscribers' E-mail addresses.
  • error: an error if the command fails.

func (*Cli) Logout

func (cli *Cli) Logout() error

Logout gracefully terminates the CommuniGate Pro CLI session. It is an alias for Cli.Close.

Returns:

  • error: an error if the command fails.

func (*Cli) MainDomainName

func (cli *Cli) MainDomainName() (string, error)

MainDomainName retrieves the name of the Main Domain.

This method executes the MAINDOMAINNAME CLI command.

Returns:

  • string: the Main Domain name.
  • error: an error if the command fails.

func (*Cli) ModifyAccountTelnums

func (cli *Cli) ModifyAccountTelnums(account string, params map[string]any) (map[string]any, error)

ModifyAccountTelnums changes the telephone numbers assigned to the Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • params: a dictionary specifying the operation to perform.

The params dictionary must contain an "op" key with one of the following values:

  • "add": requires a "telnum" key. Atomically adds the number. Returns an error if the number already exists.
  • "del": requires a "telnum" key. Atomically removes the number. Returns an error if the number is not found.
  • "pop": removes the first assigned number atomically.

This method executes the MODIFYACCOUNTTELNUMS CLI command.

Returns:

  • map[string]any: for the "pop" operation, may contain the "telnum" key with the removed number.
  • error: an error if the command fails.

func (*Cli) Noop

func (cli *Cli) Noop() error

Noop is a command that always completes successfully.

This method executes the NOOP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) PostAccountAlert

func (cli *Cli) PostAccountAlert(account, alert string) error

PostAccountAlert posts an alert message to a specific Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • alert: the text of the alert to be posted.

This method executes the POSTACCOUNTALERT CLI command.

Returns an error if the account name or alert text is empty, or if the server fails to execute the command.

This method executes the POSTACCOUNTALERT CLI command.

func (*Cli) PostClusterAlert

func (cli *Cli) PostClusterAlert(alert string) error

PostClusterAlert posts a cluster-wide Alert message.

Parameters:

  • alert: the text of the alert to be posted.

This method executes the POSTCLUSTERALERT CLI command.

Returns an error if the alert text is empty or if the server fails to execute the command.

This method executes the POSTCLUSTERALERT CLI command.

func (*Cli) PostDomainAlert

func (cli *Cli) PostDomainAlert(domain, alert string) error

PostDomainAlert posts a domain-wide Alert message.

Parameters:

  • domain: the name of an existing Domain.
  • alert: the text of the alert to be posted.

This method executes the POSTDOMAINALERT CLI command.

Returns an error if the domain name or alert text is empty, or if the server fails to execute the command.

This method executes the POSTDOMAINALERT CLI command.

func (*Cli) PostServerAlert

func (cli *Cli) PostServerAlert(alert string) error

PostServerAlert posts a server-wide Alert message.

Parameters:

  • alert: the text of the alert to be posted.

This method executes the POSTSERVERALERT CLI command.

Returns an error if the alert text is empty or if the server fails to execute the command.

This method executes the POSTSERVERALERT CLI command.

func (*Cli) ProcessBounce

func (cli *Cli) ProcessBounce(list, subscriber string, fatal bool) error

ProcessBounce performs the same action the List Manager performs when it receives a bounce message for the subscriber address.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • subscriber: the E-mail address of the list subscriber.
  • fatal: use the FATAL keyword to emulate a "fatal" bounce. Otherwise the command emulates a non-fatal bounce.

This method executes the PROCESSBOUNCE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) Query

func (cli *Cli) Query(cmd string, args ...any) (res any, err error)

Query sends a command to CommuniGate Pro CLI and unmarshals the response into a Go type. It automatically handles connection health and session state.

Parameters:

  • cmd: the CLI command string (e.g., "GETACCOUNTSETTINGS").
  • args: variadic arguments that will be marshaled into the CLI command format.

Returns:

  • any: the unmarshaled result from the server.
  • error: an error if the command fails.

func (*Cli) QueryNV

func (cli *Cli) QueryNV(cmd string, args ...any) (err error)

QueryNV (No Value) sends a command where only the success status code is needed. It is useful for operations like updates where the server doesn't return data.

Parameters:

  • cmd: the CLI command string.
  • args: variadic arguments for the command.

Returns:

  • error: an error if the command fails.

func (*Cli) ReadClusterPBXFile

func (cli *Cli) ReadClusterPBXFile(file string) ([]byte, error)

ReadClusterPBXFile reads a file from the cluster-wide Real-Time Application Environment.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".

This method executes the READCLUSTERPBXFILE CLI command.

Returns:

  • []byte: a datablock with the file contents.
  • error: an error if the command fails.

func (*Cli) ReadClusterSkinFile

func (cli *Cli) ReadClusterSkinFile(skin, file string) ([]byte, time.Time, error)

ReadClusterSkinFile reads a file from a custom Cluster Skin.

Parameters:

  • skin: the name of an existing Cluster Skin.
  • file: the name of an existing file in the specified Cluster Skin.

This method executes the READCLUSTERSKINFILE CLI command.

Returns:

  • []byte: the Skin file content.
  • time.Time: the file modification date.
  • error: an error if the command fails.

func (*Cli) ReadDomainPBXFile

func (cli *Cli) ReadDomainPBXFile(domain, file string) ([]byte, error)

ReadDomainPBXFile reads a file from the Domain Real-Time Application Environment.

Parameters:

  • domain: the Domain name.
  • file: the file name. For national subsets, specify "language/fileName".

This method executes the READDOMAINPBXFILE CLI command.

Returns:

  • []byte: a datablock with the file contents.
  • error: an error if the command fails.

func (*Cli) ReadDomainSkinFile

func (cli *Cli) ReadDomainSkinFile(domain, skin, file string) ([]byte, time.Time, error)

ReadDomainSkinFile reads a file from a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of an existing Domain Skin.
  • file: the name of an existing file in the Skin.

This method executes the READDOMAINSKINFILE CLI command.

Returns:

  • []byte: the Skin file content.
  • time.Time: the file modification date.
  • error: an error if the command fails.

func (*Cli) ReadNodeStatus

func (cli *Cli) ReadNodeStatus(taskID string) (any, error)

ReadNodeStatus reads the current application status of an existing PBX Task.

Parameters:

  • taskID: the Task ID.

This method executes the READNODESTATUS CLI command.

Returns:

  • any: the application status object returned by the task.
  • error: an error if the command fails.

func (*Cli) ReadServerPBXFile

func (cli *Cli) ReadServerPBXFile(file string) ([]byte, error)

ReadServerPBXFile reads a file from the Server-wide Real-Time Application Environment.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".

This method executes the READSERVERPBXFILE CLI command.

Returns:

  • []byte: a datablock with the file contents.
  • error: an error if the command fails.

func (*Cli) ReadServerSkinFile

func (cli *Cli) ReadServerSkinFile(skin, file string) ([]byte, time.Time, error)

ReadServerSkinFile reads a file from a custom Server Skin.

Parameters:

  • skin: the name of an existing Server Skin.
  • file: the name of an existing file in the Skin.

This method executes the READSERVERSKINFILE CLI command.

Returns:

  • []byte: the Skin file content.
  • time.Time: the file modification date.
  • error: an error if the command fails.

func (*Cli) ReadStockPBXFile

func (cli *Cli) ReadStockPBXFile(file string) ([]byte, error)

ReadStockPBXFile reads a file from the stock (built-in) Real-Time Application Environment.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".

This method executes the READSTOCKPBXFILE CLI command.

Returns:

  • []byte: a datablock with the file contents.
  • error: an error if the command fails.

func (*Cli) ReadStockSkinFile

func (cli *Cli) ReadStockSkinFile(skin, file string) ([]byte, time.Time, error)

ReadStockSkinFile reads a file from a built-in (stock) Skin.

Parameters:

  • skin: the name of an existing built-in Skin.
  • file: the name of an existing file in the Skin.

This method executes the READSTOCKSKINFILE CLI command.

Returns:

  • []byte: the Skin file content.
  • time.Time: the file modification date.
  • error: an error if the command fails.

func (*Cli) ReadStorageFile

func (cli *Cli) ReadStorageFile(account, file string, offset, size int64, authAccount string) (*StorageFileContent, error)

ReadStorageFile retrieves a file or its slice from the Account File Storage.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • file: the name of the File Storage file to be retrieved.
  • offset: file position to start reading from.
  • size: maximum number of data bytes to return. Use 0 for no limit.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the READSTORAGEFILE CLI command.

Returns:

  • *StorageFileContent: structure containing data, modification time, and current size.
  • error: an error if the command fails.

func (*Cli) ReadStorageFileAttr

func (cli *Cli) ReadStorageFileAttr(account, file string, attrs []string, authAccount string) ([]any, error)

ReadStorageFileAttr reads attributes of an Account File Storage file or directory.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • file: the name of the file or directory.
  • attrs: an optional array of attribute names to retrieve.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the READSTORAGEFILEATTR CLI command.

Returns:

  • []any: an array of XML elements containing the requested attributes.
  • error: an error if the command fails.

func (*Cli) ReadSubscribers

func (cli *Cli) ReadSubscribers(list, filter string, limit int) ([]SubscriberInfo, error)

ReadSubscribers retrieves list subscribers with detailed information.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • filter: an optional substring to filter subscriber addresses.
  • limit: limits the number of subscriber dictionaries returned.

This method executes the READSUBSCRIBERS CLI command.

Returns:

  • []SubscriberInfo: an array of subscriber descriptor structures.
  • error: an error if the command fails.

func (*Cli) ReconnectClusterAdmin

func (cli *Cli) ReconnectClusterAdmin() error

ReconnectClusterAdmin forces a Dynamic Cluster member to re-open all its inter-cluster Administrative connections.

This method executes the RECONNECTCLUSTERADMIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RefreshOSData

func (cli *Cli) RefreshOSData() error

RefreshOSData makes the Server re-read IP and DNS data from the OS.

This method executes the REFRESHOSDATA CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RejectQueueMessage

func (cli *Cli) RejectQueueMessage(id int64, report string) error

RejectQueueMessage rejects a message from the Server Queue.

Parameters:

  • id: the message ID.
  • report: an optional text to be included in the bounce report. If the parameter is "NONDN", no DSN report message is generated.

This method executes the REJECTQUEUEMESSAGE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RejectQueueMessages

func (cli *Cli) RejectQueueMessages(sender, report string) error

RejectQueueMessages rejects all messages sent by the specified sender from the Server Queue.

Parameters:

  • sender: the authenticated sender's name.
  • report: an optional text to be included in the bounce report. If the parameter is "NONDN", no DSN report message is generated.

Note: In a Dynamic Cluster environment this command rejects messages from all server queues.

This method executes the REJECTQUEUEMESSAGES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ReleaseSMTPQueue

func (cli *Cli) ReleaseSMTPQueue(queue string) error

ReleaseSMTPQueue releases an SMTP queue.

Parameters:

  • queue: the queue (domain) name to release.

Note: In a Dynamic Cluster environment this command releases the specified SMTP queue on all servers.

This method executes the RELEASESMTPQUEUE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ReloadDirectoryDomains

func (cli *Cli) ReloadDirectoryDomains() error

ReloadDirectoryDomains forces the server to scan the Domains Directory subtree. This allows finding additional Directory-based Domains created bypassing the CLI.

This method executes the RELOADDIRECTORYDOMAINS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RelocateDirectoryUnit

func (cli *Cli) RelocateDirectoryUnit(unit, mountPoint string, shared bool) error

RelocateDirectoryUnit re-mounts an existing Directory Unit on a different mount point.

Parameters:

  • unit: the Directory Unit name.
  • mountPoint: the new mount point (mount DN).
  • shared: if true, this is a cluster-wide Directory Unit name.

This method executes the RELOCATEDIRECTORYUNIT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RemoveAccountAlert

func (cli *Cli) RemoveAccountAlert(account, timeStamp string) error

RemoveAccountAlert removes a specific alert message from an Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • timeStamp: the exact timestamp string of the alert to be removed, as retrieved by GetAccountAlerts.

This method executes the REMOVEACCOUNTALERT CLI command.

Returns an error if the account name or timeStamp is empty, or if the server fails to execute the command.

This method executes the REMOVEACCOUNTALERT CLI command.

func (*Cli) RemoveAccountSubset

func (cli *Cli) RemoveAccountSubset(account, subset string) error

RemoveAccountSubset removes a specific Account "dataset" by name.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • subset: the name of an existing data subset in the specified Account.

This method executes the REMOVEACCOUNTSUBSET CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RemoveClusterAlert

func (cli *Cli) RemoveClusterAlert(timeStamp string) error

RemoveClusterAlert removes a specific cluster-wide alert message.

Parameters:

  • timeStamp: the exact timestamp string of the cluster-wide alert to be removed, as retrieved by GetClusterAlerts.

This method executes the REMOVECLUSTERALERT CLI command.

Returns an error if the timeStamp is empty or if the server fails to execute the command.

This method executes the REMOVECLUSTERALERT CLI command.

func (*Cli) RemoveDomainAlert

func (cli *Cli) RemoveDomainAlert(domain, timeStamp string) error

RemoveDomainAlert removes a specific domain-wide alert message.

Parameters:

  • domain: the name of an existing Domain.
  • timeStamp: the exact timestamp string of the domain alert to be removed, as retrieved by GetDomainAlerts.

This method executes the REMOVEDOMAINALERT CLI command.

Returns an error if the domain name or timeStamp is empty, or if the server fails to execute the command.

This method executes the REMOVEDOMAINALERT CLI command.

func (*Cli) RemoveServerAlert

func (cli *Cli) RemoveServerAlert(timeStamp string) error

RemoveServerAlert removes a specific server-wide alert message.

Parameters:

  • timeStamp: the exact timestamp string of the server-wide alert to be removed, as retrieved by GetServerAlerts.

This method executes the REMOVESERVERALERT CLI command.

Returns an error if the timeStamp is empty or if the server fails to execute the command.

This method executes the REMOVESERVERALERT CLI command.

func (*Cli) RenameAccount

func (cli *Cli) RenameAccount(oldName, newName, storage string) error

RenameAccount renames an existing account and optionally moves its data.

Parameters:

  • oldName: the current name of the account. The name can include the Domain name.
  • newName: the new name for the account. The name can include the Domain name.
  • storage: an optional "storage mount point" directory for the moved account data (without the .mnt suffix).

This method executes the RENAMEACCOUNT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameClusterSkin

func (cli *Cli) RenameClusterSkin(oldSkin, newSkin string) error

RenameClusterSkin renames a custom Cluster Skin.

Parameters:

  • oldSkin: the name of an existing Skin.
  • newSkin: the new name for the Skin.

This method executes the RENAMECLUSTERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameDomain

func (cli *Cli) RenameDomain(oldName, newName string, storage string) error

RenameDomain changes the name of an existing secondary Domain.

Parameters:

  • oldName: the name of an existing secondary Domain.
  • newName: the new name for the Domain.
  • storage: an optional new "storage mount Point" directory for the Domain data.

This method executes the RENAMEDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameDomainSkin

func (cli *Cli) RenameDomainSkin(domain, oldSkin, newSkin string) error

RenameDomainSkin renames a custom named Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • oldSkin: the name of an existing named Skin.
  • newSkin: the new name for the Skin.

This method executes the RENAMEDOMAINSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameForwarder

func (cli *Cli) RenameForwarder(oldName, newName string) error

RenameForwarder renames Forwarders.

Parameters:

  • oldName: the name of an existing Forwarder. The name can include the Domain name.
  • newName: the new Forwarder name. The name can include the Domain name.

This method executes the RENAMEFORWARDER CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameGroup

func (cli *Cli) RenameGroup(oldName, newName string) error

RenameGroup renames Groups.

Parameters:

  • oldName: the name of an existing Group. The name can include the Domain name.
  • newName: the new Group name. The name can include the Domain name.

This method executes the RENAMEGROUP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameList

func (cli *Cli) RenameList(oldName, newName string) error

RenameList renames a mailing list.

Parameters:

  • oldName: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • newName: the new name for the mailing list.

This method executes the RENAMELIST CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameMailbox

func (cli *Cli) RenameMailbox(account, oldName, newName string, recursive bool, authAccount string) error

RenameMailbox renames a Mailbox in the specified Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • oldName: the name of the Mailbox to be renamed.
  • newName: the new name for the Mailbox.
  • recursive: if true, the keyword MAILBOXES is used, and all nested Mailboxes (submailboxes) are renamed, too.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the RENAMEMAILBOX CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameNamedTask

func (cli *Cli) RenameNamedTask(oldTask, newTask string) error

RenameNamedTask renames an existing Named Task.

Parameters:

  • oldTask: the name of an existing Named Task. The name can include the Domain name.
  • newTask: the new Named Task name.

This method executes the RENAMENAMEDTASK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameServerSkin

func (cli *Cli) RenameServerSkin(oldSkin, newSkin string) error

RenameServerSkin renames a custom Server Skin.

Parameters:

  • oldSkin: the name of an existing Skin.
  • newSkin: the new name for the Skin.

This method executes the RENAMESERVERSKIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) RenameStorageFile

func (cli *Cli) RenameStorageFile(account, oldName, newName, authAccount string) error

RenameStorageFile renames a file or a file directory in the Account File Storage.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • oldName: the name of the existing File Storage file or directory.
  • newName: the new name for the file or directory.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the RENAMESTORAGEFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ReportFailedLoginAddress

func (cli *Cli) ReportFailedLoginAddress(ip net.IP) error

ReportFailedLoginAddress increments the counter of failed Login attempts from the specified IP address.

Parameters:

  • ip: the Network IP Address to report.

This method executes the REPORTFAILEDLOGINADDRESS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ResetAccountStat

func (cli *Cli) ResetAccountStat(account string, key string) error

ResetAccountStat resets statistics data about the specified Account.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • key: an optional the name of the statistical entry to reset. If the key is not specified, all Account statistical entries are reset.

This method executes the RESETACCOUNTSTAT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ResetDomainStat

func (cli *Cli) ResetDomainStat(domain string, key string) error

ResetDomainStat resets statistics data about the specified Domain.

Parameters:

  • domain: the name of an existing Domain. The asterisk (*) symbol can be used to specify the Domain of the current authenticated Account.
  • key: an optional the name of the statistical entry to reset. If the key is not specified, all Domain statistical entries are reset.

This method executes the RESETDOMAINSTAT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) ResumeDomain

func (cli *Cli) ResumeDomain(domain string) error

ResumeDomain resumes a suspended Domain so Accounts can be opened.

Parameters:

  • domain: the name of the Domain to be resumed.

This method executes the RESUMEDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) Roster

func (cli *Cli) Roster(account string, params map[string]any) (map[string]any, error)

Roster manages the Account contact list (IM/Presence).

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • params: a dictionary containing the "what" string element (List, Update, remove, Presence, probe) and operation-specific elements.

This method executes the ROSTER CLI command.

Returns:

  • map[string]any: a dictionary with the roster operation results.
  • error: an error if the command fails.

func (*Cli) Route

func (cli *Cli) Route(address string, mode string) ([]string, error)

Route retrieves the routing for the specified address.

Parameters:

  • address: the e-mail address to be processed.
  • mode: an optional the routing type (mail, access, or signal). Defaults to access.

This method executes the ROUTE CLI command.

Returns:

  • []string: an array containing [module, host, address].
  • error: an error if the command fails.

func (*Cli) RunScript

func (cli *Cli) RunScript(account, prog, entry string, param map[string]any) (any, error)

RunScript executes a synchronous script (CG/PL) on the server. Unlike PBX tasks, this command blocks until the script completes and returns the result object directly.

Parameters:

  • account: the name of the Account. The script is started on this Account behalf. The name can include the Domain name. If the Domain name is not specified, the current user Domain is used.
  • prog: the name of the script file (the .scgp file) to start.
  • entry: an optional script entry point. If empty, "main" is used.
  • param: an optional map of parameters passed to the script. Accessible via Vars().startParameter in CG/PL.

This method executes the PROGRAM CLI command.

Returns:

  • any: the object returned by the script (string, map, array, etc.).
  • error: an error if the command fails.

func (*Cli) Send

func (cli *Cli) Send(cmd string, args ...any) (err error)

Send marshals and sends a raw command to the CommuniGate Pro CLI. It handles automatic reconnection if the session has timed out.

Parameters:

  • cmd: the CLI command string.
  • args: variadic arguments to be appended to the command.

Returns:

  • error: an error if the command fails.

func (*Cli) SendTaskEvent

func (cli *Cli) SendTaskEvent(taskID, event string, param any) error

SendTaskEvent sends an Event to an existing PBX Task.

Parameters:

  • taskID: the Task ID.
  • event: the name of the Event to send.
  • param: an optional event parameter.

This method executes the SENDTASKEVENT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountACL

func (cli *Cli) SetAccountACL(account string, acl map[string]any, authAccount string) error

SetAccountACL modifies the Access Control List (ACL) for Account Access Rights.

Parameters:

  • account: the name of the target Account. Use "*" for the current authenticated user.
  • acl: a dictionary where keys are identifiers (e.g., "anyone" or "user@domain") and values are strings with access right symbols.
  • authAccount: an optional name of an Account on whose behalf the operation is executed. Requires Admin rights for the target account.

Modification rules for the value strings:

  • starts with "+": rights are added to the existing set.
  • starts with "-": rights are removed from the existing set.
  • otherwise: the string replaces the current set of rights.
  • empty string result: the ACL entry for that identifier is removed.

This method executes the SETACCOUNTACL CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountAccessModes

func (cli *Cli) SetAccountAccessModes(account string, modes []string) error

SetAccountAccessModes updates the allowed access protocols/modes for an Account.

Parameters:

  • account: the name of an existing Account.
  • modes: a slice of strings representing allowed protocols (e.g., "IMAP", "POP", "HTTP").

Behavior:

  • If modes is nil: the setting is removed (inherited from Domain/Server defaults).
  • If modes is empty: access is restricted to "None" (explicitly blocking all protocols).
  • If modes contains values: an array is constructed with a prefix (30) followed by the specified modes to satisfy the CommuniGate Pro CLI dictionary format.

This is a high-level helper that internally uses UpdateAccountSettings to modify the "AccessModes" key.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountAlerts

func (cli *Cli) SetAccountAlerts(account string, alerts map[string]any) error

SetAccountAlerts replaces the entire Account alert dictionary.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • alerts: a dictionary used to replace the current Account alert dictionary.

This method executes the SETACCOUNTALERTS CLI command.

Returns an error if the account name is empty, the alerts map is nil, or if the server fails to execute the command.

This method executes the SETACCOUNTALERTS CLI command.

func (*Cli) SetAccountAliases

func (cli *Cli) SetAccountAliases(account string, aliases []string) error

SetAccountAliases sets the list of aliases for the specified Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • aliases: a slice of strings containing the new Account alias names.

This is an "all-or-nothing" operation: all existing aliases for the Account are removed and replaced with the ones provided. To clear all aliases, pass an empty (but non-nil) slice.

This method executes the SETACCOUNTALIASES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountDefaultPrefs

func (cli *Cli) SetAccountDefaultPrefs(domain string, settings map[string]any) error

SetAccountDefaultPrefs replaces the Default Account Preferences for the Domain.

Parameters:

  • domain: the Domain name. If empty, applies to the authenticated user Domain.
  • settings: a dictionary used to replace the Default Account Preferences.

This method executes the SETACCOUNTDEFAULTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountDefaults

func (cli *Cli) SetAccountDefaults(domain string, settings map[string]any) error

SetAccountDefaults replaces the Domain Default Account settings.

Parameters:

  • domain: an optional Domain name.
  • settings: a dictionary used to replace the Domain Default Account settings.

This method executes the SETACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountMailRules

func (cli *Cli) SetAccountMailRules(account string, rules []MailRule) error

SetAccountMailRules sets the list of Account Queue Mail Rules.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rules: a slice of MailRule structures containing the new rules.

This command replaces all existing Mail Rules for the account with the provided set. To clear all rules, pass an empty (but non-nil) slice. Mail Rules are processed by the Enqueuer component when a message is delivered to the account's INBOX.

Note: Any user can use this method to modify rules for their own account.

This method executes the SETACCOUNTMAILRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountPassword

func (cli *Cli) SetAccountPassword(account, password, method, tag string, check bool) error

SetAccountPassword updates the password for the specified Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • password: the new password string. If empty and a tag is provided, the corresponding application-specific password is removed.
  • method: an optional Account Access Mode. "SIP" modifies the Alternative SIP Password; "RADIUS" modifies the Alternative RADIUS Password. Otherwise, the primary CommuniGate Password is modified.
  • tag: an optional tag for an application-specific password.
  • check: if true, the operation succeeds only if the new password matches the server's size and complexity restrictions.

Any user can modify their own password (complexity check is always enforced for self-service updates).

This method executes the SETACCOUNTPASSWORD CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountPrefs

func (cli *Cli) SetAccountPrefs(account string, settings map[string]any) error

SetAccountPrefs sets the Preferences for the specified Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • settings: a dictionary containing the new preference settings.

This command completely replaces all existing Account Preferences with the provided ones. Preferences typically include user interface settings (WebUser), language parameters, time zones, and client-specific configurations.

This method executes the SETACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountRIMAPs

func (cli *Cli) SetAccountRIMAPs(account string, records map[string]any) error

SetAccountRIMAPs sets the Account RIMAP records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • records: a dictionary containing the Account RIMAP records.

All existing Account RIMAP records are removed and replaced with the provided dictionary.

This method executes the SETACCOUNTRIMAPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountRPOPs

func (cli *Cli) SetAccountRPOPs(account string, records map[string]any) error

SetAccountRPOPs sets the Account RPOP records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • records: a dictionary containing the Account RPOP records.

All existing Account RPOP records are removed and replaced with the provided dictionary.

This method executes the SETACCOUNTRPOPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountRSIPs

func (cli *Cli) SetAccountRSIPs(account string, records map[string]any) error

SetAccountRSIPs sets the Account RSIP records.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • records: a dictionary containing the Account RSIP records.

All existing Account RSIP records are removed and replaced with the provided dictionary.

This method executes the SETACCOUNTRSIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountRights

func (cli *Cli) SetAccountRights(account string, rights []string) error

SetAccountRights sets the Account Server Access rights.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rights: this array should contain the Access Right codes.

Note: This operation is not additive. All old Account access rights are removed and replaced by the rights array.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountSettings

func (cli *Cli) SetAccountSettings(account string, settings map[string]any) error

SetAccountSettings changes the Account settings.

Parameters:

  • account: the name of an existing Account.
  • settings: a dictionary used to replace the Account settings dictionary.

All existing Account settings are removed and replaced with the provided dictionary.

This method executes the SETACCOUNTSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountSignalRules

func (cli *Cli) SetAccountSignalRules(account string, rules []SignalRule) error

SetAccountSignalRules sets the Account Signal Rules.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rules: a slice of SignalRule structures containing the new Signal Rules.

All existing Account Signal Rules are removed and replaced with the provided slice.

This method executes the SETACCOUNTSIGNALRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountTelnums

func (cli *Cli) SetAccountTelnums(account string, telnums []string) error

SetAccountTelnums assigns telephone numbers to the Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • telnums: a slice containing the telephone number strings.

All existing numbers assigned to the Account are removed and replaced with the provided slice.

This method executes the SETACCOUNTTELNUMS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountTemplate

func (cli *Cli) SetAccountTemplate(domain string, settings map[string]any) error

SetAccountTemplate replaces the Account Template settings for the Domain.

Parameters:

  • domain: an optional Domain name. If empty, applies to the administrator Domain.
  • settings: a dictionary used to replace the Domain Account Template.

This method executes the SETACCOUNTTEMPLATE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetAccountType

func (cli *Cli) SetAccountType(account string, accType AccountType) error

SetAccountType changes the Account type.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • accType: the new Account type (e.g., MultiMailbox, AGrade).

Note: the current Account type must also belong to the target type set for the operation to succeed.

This method executes the SETACCOUNTTYPE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetBanned

func (cli *Cli) SetBanned(settings *BannedLines) error

SetBanned sets the server-wide Banned Message Lines settings.

Parameters:

  • settings: new server Banned settings.

This method executes the SETBANNED CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetBlacklistedIPs

func (cli *Cli) SetBlacklistedIPs(list IPList) error

SetBlacklistedIPs updates the server-wide Blacklisted IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETBLACKLISTEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClientIPs

func (cli *Cli) SetClientIPs(list IPList) error

SetClientIPs updates the server-wide Client IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLIENTIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterAccountDefaults

func (cli *Cli) SetClusterAccountDefaults(settings map[string]any) error

SetClusterAccountDefaults replaces the cluster-wide Default Account settings.

Parameters:

  • settings: a dictionary used to replace the Default Account settings.

This method executes the SETCLUSTERACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterAccountPrefs

func (cli *Cli) SetClusterAccountPrefs(settings map[string]any) error

SetClusterAccountPrefs replaces the cluster-wide Default Account Preferences.

Parameters:

  • settings: a dictionary used to replace the Default Account Preferences.

This method executes the SETCLUSTERACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterAlerts

func (cli *Cli) SetClusterAlerts(alerts map[string]any) error

SetClusterAlerts replaces the entire cluster-wide Alert dictionary.

Parameters:

  • alerts: a dictionary used to replace the current Cluster alert dictionary.

This method executes the SETCLUSTERALERTS CLI command.

Returns an error if the server fails to execute the command.

This method executes the SETCLUSTERALERTS CLI command.

func (*Cli) SetClusterBanned

func (cli *Cli) SetClusterBanned(settings *BannedLines) error

SetClusterBanned sets the Cluster-wide Banned Message Lines settings.

Parameters:

  • settings: new cluster-wide Banned settings.

This method executes the SETCLUSTERBANNED CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterBlacklistedIPs

func (cli *Cli) SetClusterBlacklistedIPs(list IPList) error

SetClusterBlacklistedIPs updates the Cluster-wide Blacklisted IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERBLACKLISTEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterClientIPs

func (cli *Cli) SetClusterClientIPs(list IPList) error

SetClusterClientIPs updates the Cluster-wide Client IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERCLIENTIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterDebugIPs

func (cli *Cli) SetClusterDebugIPs(list IPList) error

SetClusterDebugIPs updates the Cluster-wide Debug IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERDEBUGIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterDeniedIPs

func (cli *Cli) SetClusterDeniedIPs(list IPList) error

SetClusterDeniedIPs updates the Cluster-wide Denied IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERDENIEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterDirectoryIntegration

func (cli *Cli) SetClusterDirectoryIntegration(settings map[string]any) error

SetClusterDirectoryIntegration replaces the cluster-wide Directory Integration settings.

Parameters:

  • settings: a dictionary used to replace the Directory Integration settings.

This method executes the SETCLUSTERDIRECTORYINTEGRATION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterDomainDefaults

func (cli *Cli) SetClusterDomainDefaults(settings map[string]any) error

SetClusterDomainDefaults replaces the cluster-wide default Domain settings.

Parameters:

  • settings: a dictionary used to replace the default Domain settings.

This method executes the SETCLUSTERDOMAINDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterIntercept

func (cli *Cli) SetClusterIntercept(settings map[string]any) error

SetClusterIntercept updates the Cluster-wide Lawful Intercept settings.

Parameters:

  • settings: a dictionary containing the new Intercept settings.

This method executes the SETCLUSTERINTERCEPT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterLANIPs

func (cli *Cli) SetClusterLANIPs(list IPList) error

SetClusterLANIPs updates the Cluster-wide LAN IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERLANIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterMailRules

func (cli *Cli) SetClusterMailRules(rules []MailRule) error

SetClusterMailRules updates the Cluster-wide Automated Mail Processing Rules.

Parameters:

  • rules: an array of new Cluster Queue Mail Rules.

This method executes the SETCLUSTERMAILRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterNatSiteIPs

func (cli *Cli) SetClusterNatSiteIPs(list IPList) error

SetClusterNatSiteIPs updates the Cluster-wide NAT Site IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERNATSITEIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterNatedIPs

func (cli *Cli) SetClusterNatedIPs(list IPList) error

SetClusterNatedIPs updates the Cluster-wide NATed IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERNATEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterNetwork

func (cli *Cli) SetClusterNetwork(settings map[string]any) error

SetClusterNetwork updates the Cluster-wide Network settings.

Parameters:

  • settings: a dictionary containing the new network settings.

This method executes the SETCLUSTERNETWORK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterRouterSettings

func (cli *Cli) SetClusterRouterSettings(settings map[string]any) error

SetClusterRouterSettings updates the Cluster-wide Router settings.

Parameters:

  • settings: a dictionary containing new Router settings.

This method executes the SETCLUSTERROUTERSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterRouterTable

func (cli *Cli) SetClusterRouterTable(table RouterList) error

SetClusterRouterTable updates the Cluster-wide Router Table.

Parameters:

  • table: the new set of routing rules.

This method executes the SETCLUSTERROUTERTABLE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterSettings

func (cli *Cli) SetClusterSettings(settings map[string]any) error

SetClusterSettings sets the Cluster-wide settings.

Parameters:

  • settings: a dictionary containing the new Cluster settings.

This method executes the SETCLUSTERSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterSignalRules

func (cli *Cli) SetClusterSignalRules(rules []SignalRule) error

SetClusterSignalRules updates the Cluster-wide Automated Signal Processing Rules.

Parameters:

  • rules: an array of new Cluster Signal Rules.

This method executes the SETCLUSTERSIGNALRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterTrustedCerts

func (cli *Cli) SetClusterTrustedCerts(certs []string) error

SetClusterTrustedCerts replaces the cluster-wide list of Trusted Certificates.

Parameters:

  • certs: an array of Base64-encoded X.509 certificate data or PEM.

This method executes the SETCLUSTERTRUSTEDCERTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetClusterWhiteHoleIPs

func (cli *Cli) SetClusterWhiteHoleIPs(list IPList) error

SetClusterWhiteHoleIPs updates the Cluster-wide WhiteHole IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETCLUSTERWHITEHOLEIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDNRSettings

func (cli *Cli) SetDNRSettings(settings map[string]any) error

SetDNRSettings updates the DNR (Domain Name Resolver) settings.

Parameters:

  • settings: a dictionary containing new DNR settings.

This method executes the SETDNRSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDebug

func (cli *Cli) SetDebug(debug bool)

SetDebug enables or disables raw protocol logging to os.Stderr.

Parameters:

  • debug: if true, all sent (>>>) and received (<<<) raw data will be printed to the standard error stream.

func (*Cli) SetDebugIPs

func (cli *Cli) SetDebugIPs(list IPList) error

SetDebugIPs updates the server-wide Debug IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETDEBUGIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDeniedIPs

func (cli *Cli) SetDeniedIPs(list IPList) error

SetDeniedIPs updates the server-wide Denied IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETDENIEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDirectoryAccessRights

func (cli *Cli) SetDirectoryAccessRights(shared bool, rights []DirAccessRight) error

SetDirectoryAccessRights sets the Directory Access Rights.

Parameters:

  • shared: if true, the cluster-wide Access Rights are set.
  • rights: a slice of DirAccessRight structures specifying the new ACLs.

This method executes the SETDIRECTORYACCESSRIGHTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDirectoryIntegration

func (cli *Cli) SetDirectoryIntegration(settings map[string]any) error

SetDirectoryIntegration replaces the server-wide Directory Integration settings.

Parameters:

  • settings: a dictionary used to replace the Directory Integration settings.

This method executes the SETDIRECTORYINTEGRATION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDirectoryUnit

func (cli *Cli) SetDirectoryUnit(unit string, shared bool, settings map[string]any) error

SetDirectoryUnit changes the Directory Unit settings.

Parameters:

  • unit: the Directory Unit name.
  • shared: if true, this is a cluster-wide Directory Unit name.
  • settings: a dictionary specifying the new Directory Unit settings.

This method executes the SETDIRECTORYUNIT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDomainAlerts

func (cli *Cli) SetDomainAlerts(domain string, alerts map[string]any) error

SetDomainAlerts replaces the entire Domain alert dictionary.

Parameters:

  • domain: an optional name of an existing Domain. If an empty string is provided, the command targets the current domain context.
  • alerts: a dictionary used to replace the current Domain alert dictionary.

This method executes the SETDOMAINALERTS CLI command.

Returns an error if the server fails to execute the command.

This method executes the SETDOMAINALERTS CLI command.

func (*Cli) SetDomainAliases

func (cli *Cli) SetDomainAliases(domain string, aliases []string) error

SetDomainAliases sets the Domain aliases, replacing all existing ones.

Parameters:

  • domain: the name of an existing Domain.
  • aliases: an array of Domain alias name strings.

This method executes the SETDOMAINALIASES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDomainDefaults

func (cli *Cli) SetDomainDefaults(settings map[string]any) error

SetDomainDefaults replaces the server-wide default Domain settings.

Parameters:

  • settings: a dictionary used to replace the default Domain settings.

This method executes the SETDOMAINDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDomainMailRules

func (cli *Cli) SetDomainMailRules(domain string, rules []MailRule) error

SetDomainMailRules sets the Domain Queue Mail Rules, replacing all old ones.

Parameters:

  • domain: the name of an existing Domain.
  • rules: an array containing the new Domain Queue Rules.

This method executes the SETDOMAINMAILRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDomainSettings

func (cli *Cli) SetDomainSettings(domain string, settings map[string]any) error

SetDomainSettings replaces the entire Domain settings dictionary.

Parameters:

  • domain: the name of an existing Domain.
  • settings: a dictionary used to replace the Domain settings.

This method executes the SETDOMAINSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetDomainSignalRules

func (cli *Cli) SetDomainSignalRules(domain string, rules []SignalRule) error

SetDomainSignalRules sets the Domain Signal Rules, replacing all old ones.

Parameters:

  • domain: the name of an existing Domain.
  • rules: an array containing the new Domain Signal Rules.

This method executes the SETDOMAINSIGNALRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetFileSubscription

func (cli *Cli) SetFileSubscription(account string, subs []string) error

SetFileSubscription sets the Account "subscribed files" list.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • subs: an array of strings where each element is a file name.

This method executes the SETFILESUBSCRIPTION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetGroup

func (cli *Cli) SetGroup(group string, settings map[string]any, members []string) error

SetGroup sets the Group settings.

Parameters:

  • group: the name of an existing Group. The name can include the Domain name.
  • settings: this dictionary is used to replace the Group settings dictionary.
  • members: an optional list of group members to be included in the settings dictionary.

This method executes the SETGROUP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetLANIPs

func (cli *Cli) SetLANIPs(list IPList) error

SetLANIPs updates the set of LAN IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETLANIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetLogAll

func (cli *Cli) SetLogAll(on bool) error

SetLogAll switches on and off the "Log Everything" mode.

Parameters:

  • on: boolean to switch the mode ON or OFF.

This method executes the SETLOGALL CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetMailboxACL

func (cli *Cli) SetMailboxACL(account, mailbox string, acl map[string]string, authAccount string) error

SetMailboxACL modifies the access control list for the Account Mailbox.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of an existing Mailbox in the specified Account.
  • acl: the access right elements to be modified. Use "+" or "-" prefixes to add or remove rights.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the SETMAILBOXACL CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetMailboxAliases

func (cli *Cli) SetMailboxAliases(account string, aliases map[string]string) error

SetMailboxAliases sets the Account Mailbox aliases.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • aliases: the set of new Mailbox aliases.

This method executes the SETMAILBOXALIASES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetMailboxClass

func (cli *Cli) SetMailboxClass(account, mailbox, class, authAccount string) error

SetMailboxClass sets the "class" of an Account Mailbox.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • mailbox: the name of an existing Mailbox in the specified Account.
  • class: the Mailbox class.
  • authAccount: an optional name of an Account whose Mailbox access rights should be used.

This method executes the SETMAILBOXCLASS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetMailboxSubscription

func (cli *Cli) SetMailboxSubscription(account string, subs []string) error

SetMailboxSubscription sets the Account "subscribed Mailboxes" list.

Parameters:

  • account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
  • subs: the list of subscribed Mailboxes. Each array element should be a string with a Mailbox name.

This method executes the SETMAILBOXSUBSCRIPTION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetMediaServerSettings

func (cli *Cli) SetMediaServerSettings(settings map[string]any) error

SetMediaServerSettings sets the Media Server component settings.

Parameters:

  • settings: a dictionary containing new Media Server settings.

This method executes the SETMEDIASERVERSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetModule

func (cli *Cli) SetModule(module string, settings map[string]any) error

SetModule replaces the settings for a specific Server module.

Parameters:

  • module: the name of a CommuniGate Pro Server module.
  • settings: a dictionary containing the new module settings.

This method executes the SETMODULE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetNatSiteIPs

func (cli *Cli) SetNatSiteIPs(list IPList) error

SetNatSiteIPs updates the server-wide NAT Site IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETNATSITEIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetNatedIPs

func (cli *Cli) SetNatedIPs(list IPList) error

SetNatedIPs updates the server-wide NATed IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETNATEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetNetwork

func (cli *Cli) SetNetwork(settings map[string]any) error

SetNetwork updates the Server Network settings.

Parameters:

  • settings: a dictionary containing new network settings.

This method executes the SETNETWORK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetPostingMode

func (cli *Cli) SetPostingMode(list, subscriber string, mode any) error

SetPostingMode sets the posting mode for the specified subscriber.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • subscriber: the E-mail address of the list subscriber.
  • mode: can be UNMODERATED, MODERATEALL, PROHIBITED, SPECIAL, or a number (numberOfModerated).

This method executes the SETPOSTINGMODE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetQueueSettings

func (cli *Cli) SetQueueSettings(settings map[string]any) error

SetQueueSettings sets the Queue settings.

Parameters:

  • settings: a dictionary containing new Queue settings.

This method executes the SETQUEUESETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetRouterSettings

func (cli *Cli) SetRouterSettings(settings map[string]any) error

SetRouterSettings updates the Router settings.

Parameters:

  • settings: a dictionary containing new Router settings.

This method executes the SETROUTERSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetRouterTable

func (cli *Cli) SetRouterTable(table RouterList) error

SetRouterTable updates the Router Table.

Parameters:

  • table: the new set of routing rules.

This method executes the SETROUTERTABLE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetSMTPSendProfiles

func (cli *Cli) SetSMTPSendProfiles(settings map[string]any) error

SetSMTPSendProfiles sets the Target Host Profiles of the SMTP module.

Parameters:

  • settings: a dictionary containing the new profile settings.

This method executes the SETSMTPSENDPROFILES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerAccountDefaults

func (cli *Cli) SetServerAccountDefaults(settings map[string]any) error

SetServerAccountDefaults replaces the server-wide Default Account settings.

Parameters:

  • settings: a dictionary used to replace the Default Account settings.

This method executes the SETSERVERACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerAccountPrefs

func (cli *Cli) SetServerAccountPrefs(settings map[string]any) error

SetServerAccountPrefs replaces the server-wide Default Account Preferences.

Parameters:

  • settings: a dictionary used to replace the Default Account Preferences.

This method executes the SETSERVERACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerAlerts

func (cli *Cli) SetServerAlerts(alerts map[string]any) error

SetServerAlerts replaces the entire server-wide Alert dictionary.

Parameters:

  • alerts: a dictionary used to replace the current Server alert dictionary.

This method executes the SETSERVERALERTS CLI command.

Returns an error if the server fails to execute the command.

This method executes the SETSERVERALERTS CLI command.

func (*Cli) SetServerIntercept

func (cli *Cli) SetServerIntercept(settings map[string]any) error

SetServerIntercept updates the Lawful Intercept settings.

Parameters:

  • settings: a dictionary containing new Intercept settings.

This method executes the SETSERVERINTERCEPT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerMailRules

func (cli *Cli) SetServerMailRules(rules []MailRule) error

SetServerMailRules updates the Server-Wide Automated Mail Processing Rules.

Parameters:

  • rules: an array of new Server Queue Rules.

This method executes the SETSERVERMAILRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerSignalRules

func (cli *Cli) SetServerSignalRules(rules []SignalRule) error

SetServerSignalRules updates the Server-Wide Automated Signal Processing Rules.

Parameters:

  • rules: an array of new Server Signal Rules.

This method executes the SETSERVERSIGNALRULES CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetServerTrustedCerts

func (cli *Cli) SetServerTrustedCerts(certs []string) error

SetServerTrustedCerts replaces the server-wide list of Trusted Certificates.

Parameters:

  • certs: an array of Base64-encoded X.509 certificate data or PEM.

This method executes the SETSERVERTRUSTEDCERTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetSessionSettings

func (cli *Cli) SetSessionSettings(settings map[string]any) error

SetSessionSettings sets the user Sessions settings.

Parameters:

  • settings: a dictionary containing new Sessions settings.

This method executes the SETSESSIONSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetSignalSettings

func (cli *Cli) SetSignalSettings(settings map[string]any) error

SetSignalSettings sets the Signal component settings.

Parameters:

  • settings: a dictionary containing new component settings.

This method executes the SETSIGNALSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetStatElement

func (cli *Cli) SetStatElement(objectID, op string, val int64) error

SetStatElement updates the current value of a "Custom" Server statistics element.

Parameters:

  • objectID: the object ID of the Server statistics element.
  • op: the operation to perform: "INC" (increment) or "SET" (assignment).
  • val: the numeric value to be used in the operation.

This method executes the SETSTATELEMENT CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetTempBlacklistedIPs

func (cli *Cli) SetTempBlacklistedIPs(list *TempIPList) error

SetTempBlacklistedIPs adds addresses to the Temporary Blocked IP Addresses list.

Parameters:

  • list: a list of IP addresses in the format of the GetTempBlacklistedIPs command.

This method executes the SETTEMPBLACKLISTEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetTempUnblockableIPs

func (cli *Cli) SetTempUnblockableIPs(list *TempIPList) error

SetTempUnblockableIPs adds addresses to the Temporary UnBlockable IP Addresses set.

Parameters:

  • list: a list of IP addresses in the format of the GetTempUnBlockableIPs command.

This method executes the SETTEMPBLACKLISTEDIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetTrace

func (cli *Cli) SetTrace(facility TraceFacility, on bool) error

SetTrace switches on and off internal logging facilities that write to OS syslog.

Parameters:

  • facility: the facility name.
  • on: boolean to switch the facility ON or OFF.

This method executes the SETTRACE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SetWhiteHoleIPs

func (cli *Cli) SetWhiteHoleIPs(list IPList) error

SetWhiteHoleIPs updates the server-wide WhiteHole IP Addresses.

Parameters:

  • list: the new set of IP addresses and ranges.

This method executes the SETWHITEHOLEIPS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) Shutdown

func (cli *Cli) Shutdown() error

Shutdown initiates the stop sequence for the CommuniGate Pro Server.

This method executes the SHUTDOWN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StartPBXTask

func (cli *Cli) StartPBXTask(account, program, entry string, param any) (string, error)

StartPBXTask starts a new PBX Task on behalf of the specified Account.

Parameters:

  • account: the name of the Account. The name can include the Domain name. If the Domain name is not specified, the current user Domain is used.
  • program: the name of the program (the .sppr file) to start.
  • entry: an optional program entry point. If empty, "main" is used.
  • param: an optional specifies the program parameter. Accessible within the program via Vars().startParameter.

This method executes the PROGRAM CLI command.

Returns:

  • string: a string with the new Task ID.
  • error: an error if the command fails.

func (*Cli) StoreClusterPBXFile

func (cli *Cli) StoreClusterPBXFile(file string, data []byte) error

StoreClusterPBXFile stores a file into the cluster-wide Real-Time Application Environment. Available in the Dynamic Cluster only.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".
  • data: a datablock with the file contents.

Note: If the environment contains a file with the specified name, the old file is replaced. The file is automatically removed from the Environment cache on all cluster members.

This method executes the STORECLUSTERPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreClusterSkinFile

func (cli *Cli) StoreClusterSkinFile(skin, file string, data []byte) error

StoreClusterSkinFile stores a file into a custom Cluster Skin.

Parameters:

  • skin: the name of an existing Cluster Skin.
  • file: the Skin file name.
  • data: the file content.

This method executes the STORECLUSTERSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreDomainPBXFile

func (cli *Cli) StoreDomainPBXFile(domain, file string, data []byte) error

StoreDomainPBXFile stores a file into the Domain Real-Time Application Environment.

Parameters:

  • domain: the Domain name.
  • file: the file name. For national subsets, specify "language/fileName".
  • data: a datablock with the file contents.

Note: If the environment contains a file with the specified name, the old file is replaced. The file is automatically removed from the Environment cache.

This method executes the STOREDOMAINPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreDomainSkinFile

func (cli *Cli) StoreDomainSkinFile(domain, skin, file string, data []byte) error

StoreDomainSkinFile stores a file into a custom Domain Skin.

Parameters:

  • domain: an optional the Domain name.
  • skin: the name of an existing Domain Skin.
  • file: the Skin file name.
  • data: the file content.

This method executes the STOREDOMAINSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreServerPBXFile

func (cli *Cli) StoreServerPBXFile(file string, data []byte) error

StoreServerPBXFile stores a file into the Server-wide Real-Time Application Environment. Available for System Administrators only.

Parameters:

  • file: the file name. For national subsets, specify "language/fileName".
  • data: a datablock with the file contents.

Note: If the environment contains a file with the specified name, the old file is replaced. The file is automatically removed from the Environment cache.

This method executes the STORESERVERPBXFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreServerSkinFile

func (cli *Cli) StoreServerSkinFile(skin, file string, data []byte) error

StoreServerSkinFile stores a file into a custom Server Skin.

Parameters:

  • skin: the name of an existing Server Skin.
  • file: the Skin file name.
  • data: the file content.

This method executes the STORESERVERSKINFILE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) StoreSessionFile

func (cli *Cli) StoreSessionFile(sessionID, domain, file, uploadID string, offset SessionOffset) error

StoreSessionFile stores an uploaded file from the session "uploaded file set" as a File Storage file.

Parameters:

  • sessionID: the Session ID.
  • domain: an optional the name of Domain the session Account belongs to.
  • file: the name for the File Storage file.
  • uploadID: identifies a file in the "uploaded file set".
  • offset: an optional the file position. Can be a positive number, or constants OffsetBeg, OffsetEnd, OffsetNew.

This method executes the DOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) SuspendDomain

func (cli *Cli) SuspendDomain(domain string) error

SuspendDomain suspends a Domain, closing active accounts and preventing new ones.

Parameters:

  • domain: the name of the Domain to be suspended.

This method executes the SUSPENDDOMAIN CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) TempBlacklistIP

func (cli *Cli) TempBlacklistIP(ip net.IP, timeout time.Duration) error

TempBlacklistIP adds or removes an address from the Temporarily Blocked Addresses set.

Parameters:

  • ip: the Network IP Address to add or remove.
  • timeout: the time period the address should be blocked for. Use 0 or DELETE to remove.

This method executes the TEMPBLACKLISTIP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) TempUnblockIP

func (cli *Cli) TempUnblockIP(ip net.IP, timeout time.Duration) error

TempUnblockIP adds or removes an address from the Temporary UnBlockable IP Addresses set.

Parameters:

  • ip: the Network IP Address to add or remove.
  • timeout: the time period the address should be in the set. Use 0 or DELETE to remove.

This method executes the TEMPUNBLOCKIP CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) TestLoop

func (cli *Cli) TestLoop(seconds int) (int, error)

TestLoop tests the server CPU load by executing a calculation loop for the specified number of seconds.

Parameters:

  • seconds: duration of the test in seconds.

This method executes the TESTLOOP CLI command.

Returns:

  • int: a number that indicates the average CLI thread CPU performance.
  • error: an error if the command fails.

func (*Cli) UpdateAccountDefaultPrefs

func (cli *Cli) UpdateAccountDefaultPrefs(domain string, settings map[string]any) error

UpdateAccountDefaultPrefs modifies the Domain Default Account Preferences.

Parameters:

  • domain: the Domain name. If empty, applies to the authenticated user Domain.
  • settings: a dictionary used to modify the Domain Default Account Preferences.

This method executes the UPDATEACCOUNTDEFAULTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountDefaults

func (cli *Cli) UpdateAccountDefaults(domain string, settings map[string]any) error

UpdateAccountDefaults modifies the Default Account settings for the specified Domain.

Parameters:

  • domain: the Domain name. If empty, applies to the administrator Domain.
  • settings: a dictionary used to modify the Domain Default Account settings.

This method executes the UPDATEACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountInfo

func (cli *Cli) UpdateAccountInfo(account string, info map[string]any) error

UpdateAccountInfo updates the Account "info" fields.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • info: a dictionary containing the Account "info" fields to be updated or added.

This method performs a partial update of the Account "info" dictionary. Only the keys provided in the info dictionary are modified; all other existing keys in the Account Information dictionary remain unchanged.

This method executes the UPDATEACCOUNTINFO CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountMailRule

func (cli *Cli) UpdateAccountMailRule(account string, rule MailRule) error

UpdateAccountMailRule updates or creates a specific Mail Rule for the Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rule: a MailRule structure containing the rule definition.

Behavior depends on the content of the rule structure:

  • if only priority and name are provided (fewer than 4 rule elements): the method updates the priority of an existing rule with the given name. If the rule does not exist, an error is returned.
  • if 4 or more elements are provided (conditions and actions included): the entire rule is stored. If a rule with the same name already exists, it is replaced.

This method executes the UPDATEACCOUNTMAILRULE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountPrefs

func (cli *Cli) UpdateAccountPrefs(account string, settings map[string]any) error

UpdateAccountPrefs modifies the Account Preferences.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • settings: a dictionary containing the preference settings to update.

This method performs a partial update of the Account Preferences. Omitted elements remain unmodified. If a value is set to the string "default", that specific preference is removed, causing the account to inherit the default value from its Domain or the System.

This method executes the UPDATEACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountSettings

func (cli *Cli) UpdateAccountSettings(account string, settings map[string]any) error

UpdateAccountSettings updates the Account settings.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • settings: a dictionary containing the settings to be updated.

This method performs a partial update of the Account settings dictionary. Omitted settings remain unmodified. If a setting value is specified as the string "default", the specific Account setting is removed, allowing the account to use the default value (typically inherited from the Domain or Class).

This method executes the UPDATEACCOUNTSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountSignalRule

func (cli *Cli) UpdateAccountSignalRule(account string, rule SignalRule) error

UpdateAccountSignalRule updates or creates a specific Signal Rule for the Account.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • rule: a SignalRule structure containing the rule definition.

Behavior depends on the content of the rule structure:

  • if only priority and name are provided (fewer than 4 rule elements): the method updates the priority of an existing Signal Rule with the given name. If the rule does not exist, an error is returned.
  • if 4 or more elements are provided (conditions and actions included): the entire rule is stored as a new Signal Rule. If a rule with the same name already exists, it is replaced.

This method executes the UPDATEACCOUNTSIGNALRULE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateAccountTemplate

func (cli *Cli) UpdateAccountTemplate(domain string, settings map[string]any) error

UpdateAccountTemplate modifies the Account Template settings for the Domain.

Parameters:

  • domain: the Domain name. If empty, applies to the administrator Domain.
  • settings: a dictionary used to modify the Domain Account Template.

This method executes the UPDATEACCOUNTTEMPLATE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateClusterAccountDefaults

func (cli *Cli) UpdateClusterAccountDefaults(settings map[string]any) error

UpdateClusterAccountDefaults modifies specific cluster-wide Default Account settings.

Parameters:

  • settings: a dictionary containing settings to update.

This method executes the UPDATECLUSTERACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateClusterAccountPrefs

func (cli *Cli) UpdateClusterAccountPrefs(settings map[string]any) error

UpdateClusterAccountPrefs modifies specific cluster-wide Default Account Preferences.

Parameters:

  • settings: a dictionary containing preferences to update.

This method executes the UPDATECLUSTERACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateClusterDomainDefaults

func (cli *Cli) UpdateClusterDomainDefaults(settings map[string]any) error

UpdateClusterDomainDefaults modifies specific cluster-wide default Domain settings.

Parameters:

  • settings: a dictionary containing settings to update.

This method executes the UPDATECLUSTERDOMAINDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateDomainDefaults

func (cli *Cli) UpdateDomainDefaults(settings map[string]any) error

UpdateDomainDefaults modifies specific server-wide default Domain settings.

Parameters:

  • settings: a dictionary containing settings to update.

This method executes the UPDATEDOMAINDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateDomainSettings

func (cli *Cli) UpdateDomainSettings(domain string, settings map[string]any) error

UpdateDomainSettings updates specific Domain settings without modifying others.

Parameters:

  • domain: the name of an existing Domain. If empty, uses the current context.
  • settings: a dictionary containing the settings to update.

This method executes the UPDATEDOMAINSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateList

func (cli *Cli) UpdateList(list string, settings map[string]any) error

UpdateList modifies list settings.

Parameters:

  • list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
  • settings: this dictionary is used to update the mailing list settings dictionary. The omitted settings will be left unmodified.

This method executes the UPDATELIST CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateLogSettings

func (cli *Cli) UpdateLogSettings(settings map[string]any) error

UpdateLogSettings modifies the Main Log settings.

Parameters:

  • settings: a dictionary containing settings to be updated.

This method executes the UPDATELOGSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateModule

func (cli *Cli) UpdateModule(module string, settings map[string]any) error

UpdateModule modifies the settings for a specific Server module.

Parameters:

  • module: the name of a CommuniGate Pro Server module.
  • settings: a dictionary containing settings to be updated.

This method executes the UPDATEMODULE CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateNamedTask

func (cli *Cli) UpdateNamedTask(task string, settings map[string]any) error

UpdateNamedTask sets the Named Task settings.

Parameters:

  • task: the name of an existing Named Task. The name can include the Domain name.
  • settings: a dictionary used to update the Named Task settings dictionary.

This method executes the UPDATENAMEDTASK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateScheduledTask

func (cli *Cli) UpdateScheduledTask(account string, task map[string]any) error

UpdateScheduledTask sets the Account Scheduled Task record.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • task: a dictionary containing the Scheduled Task data (id, program/script, etc.).

Behavior:

  • if the task "id" does not exist, a new task is created.
  • if the "program" or "script" element is missing, an existing task with the given "id" is deleted.
  • tasks can be one-time (no "period") or recurring (period is set to "day", "week", "month", "year", or a number of seconds).
  • the task executes either a Real-Time Application or a Synchronous Script.

This method executes the UPDATESCHEDULEDTASK CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateServerAccountDefaults

func (cli *Cli) UpdateServerAccountDefaults(settings map[string]any) error

UpdateServerAccountDefaults modifies specific server-wide Default Account settings.

Parameters:

  • settings: a dictionary containing settings to update.

This method executes the UPDATESERVERACCOUNTDEFAULTS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateServerAccountPrefs

func (cli *Cli) UpdateServerAccountPrefs(settings map[string]any) error

UpdateServerAccountPrefs modifies specific server-wide Default Account Preferences.

Parameters:

  • settings: a dictionary containing preferences to update.

This method executes the UPDATESERVERACCOUNTPREFS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateServerSettings

func (cli *Cli) UpdateServerSettings(settings map[string]any) error

UpdateServerSettings modifies the "other" Server settings.

Parameters:

  • settings: a dictionary containing settings to be updated.

This method executes the UPDATESERVERSETTINGS CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateSession

func (cli *Cli) UpdateSession(sessionID, domain string, data map[string]any) error

UpdateSession modifies custom parameters of a Session.

Parameters:

  • sessionID: the Session ID.
  • domain: an optional the name of Domain the session Account belongs to.
  • data: the dictionary that lists new values for the attributes to be updated.

This method executes the UPDATESESSION CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) UpdateStorageFileAttr

func (cli *Cli) UpdateStorageFileAttr(account, file string, attrs []any, authAccount string) error

UpdateStorageFileAttr updates attributes of an Account File Storage file or directory.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • file: the name of an existing file or directory.
  • attrs: an array of XML elements representing the new attribute values.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the UPDATESTORAGEFILEATTR CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) VerifyAccountIdentity

func (cli *Cli) VerifyAccountIdentity(account, identity string) (bool, error)

VerifyAccountIdentity checks if the Account is authorized to use a specific 'From:' header value.

Parameters:

  • account: the name of an existing Account. The name can include the Domain name.
  • identity: the 'From:' header value to verify (e.g., "Name <user@domain.com>").

This method executes the VERIFYACCOUNTIDENTITY CLI command.

Returns:

  • (true, nil) if the identity is verified and allowed.
  • (false, error) if the verification fails or the server returns an error.

func (*Cli) VerifyAccountPassword

func (cli *Cli) VerifyAccountPassword(account, password string) (bool, error)

VerifyAccountPassword verifies the Account password.

Parameters:

  • account: the name of an existing Account.
  • password: the password to check (clear text).

This method executes the VERIFYACCOUNTPASSWORD CLI command.

Returns:

  • (true, nil) if the password is correct.
  • (false, error) if the password is incorrect or a server error occurred.

func (*Cli) WriteLog

func (cli *Cli) WriteLog(level int, record string) error

WriteLog stores a record into the Server Log. Log records have the SYSTEM prefix.

Parameters:

  • level: the record log level.
  • record: the string to be placed into the Server Log.

This method executes the WRITELOG CLI command.

Returns:

  • error: an error if the command fails.

func (*Cli) WriteStorageFile

func (cli *Cli) WriteStorageFile(account, file string, offset any, data []byte, authAccount string) error

WriteStorageFile stores a file or creates a directory in the Account File Storage.

Parameters:

  • account: the name of an existing Account. Use "*" for current authenticated Account.
  • file: the name for the File Storage file (ends with "/" to create a directory).
  • offset: write position. Can be int (position), or string ("BEG", "END", "NEW").
  • data: datablock containing the file content. Must be empty for directory creation.
  • authAccount: an optional name of an Account on whose behalf the operation is executed.

This method executes the OFFSET CLI command.

Returns:

  • error: an error if the command fails.

type CliCode

type CliCode int

CliCode represents a numeric response status from the CommuniGate Pro server.

type DataBlock

type DataBlock []byte

DataBlock represents binary data, such as SSL certificates or keys. When marshaled, it is enclosed in square brackets [].

Unlike the standard []byte type, the data inside a DataBlock MUST already be Base64-encoded. This type serves as a transparent container and does not perform any automatic encoding.

type DirAccessRight

type DirAccessRight struct {
	Name         string   // unique name of the access rule.
	Target       string   // target attribute, or "*" for all attributes.
	BindDN       string   // subject distinguished name (DN) this rule applies to.
	Type         string   // access type: "allow", "prohibit", or "grant".
	RecordRights []string // record-level permissions (e.g., "create", "delete").
	SearchAttrs  []string // list of attributes allowed for searching.
	ReadAttrs    []string // list of attributes allowed for reading.
	ModifyAttrs  []string // list of attributes allowed for modification.
}

DirAccessRight defines a single rule for Directory Access Control.

type DomainObject

type DomainObject struct {
	Name    string     // unique identifier of the object (e.g., account name).
	Type    ObjectType // category: TypeAccount, TypeAlias, or TypeForwarder.
	Subtype string     // object-specific data.
	Targets []string   // destination addresses for aliases and forwarders.
}

DomainObject represents a generic object within a domain, holding its name, type, and associated targets.

type DomainObjectsResult

type DomainObjectsResult struct {
	Objects map[string]DomainObject
	Cookie  string
}

DomainObjectsResult contains a batch of domain objects and a cookie for paginated retrieval.

type FieldType

type FieldType int

FieldType represents a data transformation category. It instructs the library how to map a specific field to a native Go type.

const (
	// TypeAuto relies on the parser's basic detection (Atoms, Numbers, Arrays).
	TypeAuto FieldType = iota

	// TypeDateLegacy represents the "DD-MM-YYYY_HH:MM:SS" format.
	// Maps to: time.Time (UTC).
	TypeDateLegacy

	// TypeDuration represents time intervals (e.g., "10s", "1m", "never").
	// Maps to: time.Duration.
	TypeDuration

	// TypeIPList represents IP address lists as formatted in the CommuniGate Pro WebAdmin UI
	// (e.g., space-separated or multi-line addresses lists).
	// Maps to: IPList.
	TypeIPList

	// TypeIPSB represents an IP address in square brackets [1.2.3.4].
	// Maps to: net.IP.
	TypeIPSB

	// TypeIPSBSA represents a string of comma-separated square bracketed IPs: "[ip1],[ip2]".
	// Maps to: []net.IP.
	TypeIPSBSA

	// TypeSize represents storage quotas with suffixes (e.g., "10K", "5M", "unlimited").
	// Maps to: int64 (total bytes).
	TypeSize

	// TypeString forces the value to be treated as a raw string,
	// bypassing any automatic conversion.
	TypeString
)

type FileInfo

type FileInfo struct {
	Name     string    // File name
	Size     int64     // File size in bytes (STFileSize)
	Created  time.Time // File creation timestamp (STCreated)
	Modified time.Time // Last modification timestamp (STModified)
}

FileInfo represents metadata for a file in the CommuniGate Pro storage (Skins, PBX, etc.).

type GroupResult

type GroupResult struct {
	Settings map[string]any // administrative settings and attributes of the group.
	Members  []string       // list of addresses or object names belonging to the group.
}

GroupResult represents the combined data of a CommuniGate Pro group, separating operational settings from the actual member list.

type IPCIDR

type IPCIDR struct{ net.IPNet }

IPCIDR is a wrapper around net.IPNet that represents an IP address with its network mask. It is used to handle CommuniGate Pro's IP and CIDR formats, providing specialized string representation where /32 (IPv4) or /128 (IPv6) masks are omitted if they represent a single host.

type IPEntry

type IPEntry struct {
	Comment    string // optional comment after the semicolon.
	CommentPos int    // original position of the semicolon for alignment.
	IsNegative bool   // true if the entry starts with "!" (exclusion rule).
	Value      any    // the IP value: IPCIDR, IPRange, IPSeq, or IPUnknown.
}

IPEntry represents a single line in a CommuniGate Pro IP List, including the value, optional comment, and whether it is an exclusion rule.

type IPKey

type IPKey [16]byte

IPKey is a fixed-size byte array representing an IP address. It is used as a map key to provide efficient O(1) lookups and minimal memory footprint compared to string keys.

func ToKey

func ToKey(ip net.IP) IPKey

ToKey converts a net.IP address into an IPKey. It transparently handles both IPv4 and IPv6 by converting addresses to their 16-byte representation.

Parameters:

  • ip: the net.IP address to convert.

Returns:

  • IPKey: a 16-byte array suitable for use as a map key.

type IPList

type IPList []IPEntry

func (*IPList) Add

func (l *IPList) Add(input string, comment string) error

Add appends a new entry to the IP list or updates the comment/exclusion status if the entry exists.

Parameters:

  • input: the IP address, CIDR, range, or sequence to add. Supports "!" prefix for negative rules.
  • comment: the comment string to associate with this entry.

Returns:

  • error: an error if the input format is invalid.

func (IPList) Contains

func (l IPList) Contains(ip net.IP) bool

Contains checks if the specified net.IP matches any rule in the list. It respects the order of entries and correctly handles negative (exclusion) rules.

Parameters:

  • ip: the net.IP address to check.

Returns:

  • bool: true if the IP is allowed by the list rules, false otherwise.

func (*IPList) Delete

func (l *IPList) Delete(input string) error

Delete removes an entry from the IP list matching the provided input string.

Parameters:

  • input: the IP address, CIDR, or range to remove. The "!" prefix is ignored during matching.

Returns:

  • error: an error if the entry is not found or the format is invalid.

func (IPList) GetEntry

func (l IPList) GetEntry(input string) *IPEntry

GetEntry retrieves a pointer to an IPEntry matching the input string.

Parameters:

  • input: the IP representation to search for.

Returns:

  • *IPEntry: a pointer to the entry if found, nil otherwise.

func (*IPList) Insert

func (l *IPList) Insert(index int, input string, comment string, alignPos int) error

Insert places a new entry at a specific index in the list.

Parameters:

  • index: the position at which to insert the new entry.
  • input: the IP rule string (supports "!" prefix).
  • comment: the comment for the entry.
  • alignPos: the visual position of the semicolon for comment alignment.

Returns:

  • error: an error if the input format is invalid.

func (*IPList) InsertAfter

func (l *IPList) InsertAfter(marker string, input string, comment string, alignPos int) error

InsertAfter places a new entry immediately following a specific marker entry.

Parameters:

  • marker: the existing entry value to look for.
  • input: the new IP rule string to insert.
  • comment: the comment for the new entry.
  • alignPos: the visual position of the semicolon for comment alignment.

Returns:

  • error: an error if the marker is not found or input is invalid.

func (*IPList) InsertBefore

func (l *IPList) InsertBefore(marker string, input string, comment string, alignPos int) error

InsertBefore places a new entry immediately preceding a specific marker entry.

Parameters:

  • marker: the existing entry value to look for.
  • input: the new IP rule string to insert.
  • comment: the comment for the new entry.
  • alignPos: the visual position of the semicolon for comment alignment.

Returns:

  • error: an error if the marker is not found or input is invalid.

type IPRange

type IPRange struct{ Start, End net.IP } // contiguous range of IP addresses from Start to End.

type IPSeq

type IPSeq []any // comma-separated sequence of multiple IP rules.

type IPUnknown

type IPUnknown string

type MailRule

type MailRule struct {
	Priority   int    // execution order (0 to 99).
	Name       string // unique rule identifier.
	Conditions []any  // filter criteria (e.g., ["From", "is", "spammer@..."]).
	Actions    []any  // resulting actions (e.g., ["Discard"]).
	Comment    string // optional administrative note.
}

MailRule represents a standard email processing rule.

func (MailRule) GetName

func (r MailRule) GetName() string

GetName returns the unique identifier of the rule.

Returns:

func (MailRule) ToSlice

func (r MailRule) ToSlice() []any

ToSlice converts the rule structure into a raw slice format compatible with the CommuniGate Pro CLI protocol.

Returns:

  • []any: a slice containing [Priority, Name, Conditions, Actions, (Comment)].

type ObjectType

type ObjectType int

ObjectType defines the bitmask for filtering domain objects (accounts, aliases, forwarders).

const (
	TypeAccount ObjectType = 1 << iota
	TypeAlias
	TypeForwarder
	TypeAll = TypeAccount | TypeAlias | TypeForwarder
)

type RouterEntry

type RouterEntry struct {
	Rule    string // routing rule (e.g., "<*@domain.com> = user@other.com").
	Comment string // optional text after the semicolon.
	Pos     int    // original character position of the semicolon for alignment.
}

RouterEntry represents a single line in the CommuniGate Pro Routing Table.

type RouterList

type RouterList []RouterEntry

RouterList is an ordered slice of RouterEntry providing high-level manipulation methods. Since CommuniGate Pro evaluates rules from top to bottom, this structure ensures the order remains intact.

func (*RouterList) Add

func (l *RouterList) Add(rule, comment string, alignPos int)

Add appends a new rule to the end of the routing table.

Parameters:

  • rule: the routing rule string (e.g., "<*@domain.com> = user@other.com").
  • comment: optional text to be placed after the semicolon.
  • alignPos: the character position where the semicolon should be placed.

func (RouterList) Find

func (l RouterList) Find(pattern string) int

Find returns the index of the first entry where the rule contains the pattern.

Parameters:

  • pattern: the substring to search for within the routing rules.

Returns:

  • int: the zero-based index of the first match, or -1 if no match is found.

func (*RouterList) InsertAfter

func (l *RouterList) InsertAfter(pattern, rule, comment string, alignPos int) error

InsertAfter inserts a new rule immediately after the first entry that matches the specified pattern.

Parameters:

  • pattern: the substring to locate the anchor rule.
  • rule: the new routing rule string to insert.
  • comment: optional text for the new rule's comment.
  • alignPos: the character position for semicolon alignment in the new rule.

Returns:

  • error: an error if the anchor pattern is not found in the list.

func (*RouterList) InsertBefore

func (l *RouterList) InsertBefore(pattern, rule, comment string, alignPos int) error

InsertBefore inserts a new rule immediately before the first entry that matches the specified pattern.

Parameters:

  • pattern: the substring to locate the anchor rule.
  • rule: the new routing rule string to insert.
  • comment: optional text for the new rule's comment.
  • alignPos: the character position for semicolon alignment in the new rule.

Returns:

  • error: an error if the anchor pattern is not found in the list.

type Secure

type Secure int

Secure defines the authentication method used for the CommuniGate Pro CLI session.

const (
	// Plain represents standard USER/PASS authentication.
	Plain Secure = iota

	// APOP represents Authenticated Post Office Protocol (MD5-based) security.
	APOP

	// WebUser represents authentication for web-specific users.
	WebUser
)

type SessionOffset

type SessionOffset int

SessionOffset specifies the file position or write mode for session file operations.

Values:

  • (positive number): the File Storage file is rewritten/extended starting from the specified file position. The file should already exist.
  • OffsetBeg: the file is rewritten from the beginning, but its old data beyond the end of the new data is not removed.
  • OffsetEnd: the file data is appended to the end of the file. If the file does not exist, it is created.
  • OffsetNew: a new file is created and file data is stored in it. The file must not exist.
  • (zero/absent): the existing file is removed first, and a new file is created.
const (
	OffsetBeg SessionOffset = -1
	OffsetEnd SessionOffset = -2
	OffsetNew SessionOffset = -3
)

type SignalRule

type SignalRule struct {
	Priority   int    // base priority (0 to 99).
	Delay      int    // delay in seconds before the rule is applied.
	EventCode  int    // specific event trigger (EventError, EventBusy, EventNoAnswer).
	Name       string // unique rule identifier.
	Conditions []any  // signal-specific conditions.
	Actions    []any  // signaling actions (e.g., ["Redirect", "target"]).
	Comment    string // optional administrative note.
}

SignalRule represents a Real-Time Application (SIP/Signal) rule.

func (SignalRule) GetName

func (r SignalRule) GetName() string

GetName returns the unique identifier of the rule.

Returns:

func (SignalRule) ToSlice

func (r SignalRule) ToSlice() []any

ToSlice converts the rule structure into a raw slice format compatible with the CommuniGate Pro CLI protocol.

For [SignalRules], this method automatically performs priority packing (combining priority, delay, and event code).

Returns:

  • []any: a slice containing [Priority, Name, Conditions, Actions, (Comment)].

type StorageFileContent

type StorageFileContent struct {
	Data         []byte    // raw file content.
	ModifiedTime time.Time // last modification time of the file.
	CurrentSize  int64     // total size of the file in bytes.
}

StorageFileContent holds the raw data and metadata of a storage file.

type StorageFileInfo

type StorageFileInfo struct {
	TotalSize  int64 // total size in bytes of all files in the path.
	FilesCount int64 // total number of files in the path.
}

StorageFileInfo represents cumulative statistics for a storage path.

type SubscriberInfo

type SubscriberInfo struct {
	Sub            string    // subscriber's email address.
	RealName       string    // optional real name.
	Mode           string    // subscription mode (index, digest, null, etc.).
	SubscribeTime  time.Time // time when this subscriber was added.
	TimeSubscribed time.Time // time when the address was subscribed (ACAP format).
	Posts          int64     // number of postings on this list.
	Bounces        int64     // optional count of failed delivery reports received for this subscriber.
	LastBounceTime time.Time // optional time when the last delivery failure occurred for this subscriber.
	ConfirmationID int64     // subscriber's confirmation ID.
}

SubscriberInfo contains detailed metadata about a mailing list member.

type SystemInfoKey

type SystemInfoKey string

SystemInfoKey represents a recognized key for server metadata retrieval.

const (
	SysVersion         SystemInfoKey = "serverVersion" // e.g., "6.3.20"
	SysOS              SystemInfoKey = "serverOS"      // Target Operating System
	SysCPU             SystemInfoKey = "serverCPU"     // CPU Architecture
	SysMainDomain      SystemInfoKey = "mainDomainName"
	SysLicenseDomain   SystemInfoKey = "licenseDomainName"
	SysStartTime       SystemInfoKey = "startTime" // Server boot time
	SysServerInstance  SystemInfoKey = "serverInstance"
	SysClusterInstance SystemInfoKey = "clusterInstance"
	SysCharsets        SystemInfoKey = "knownCharsets"
	SysDigesters       SystemInfoKey = "knownDigesters"
	SysCiphers         SystemInfoKey = "knownCiphers" // Supported SSL/TLS ciphers
)

type TempIP

type TempIP struct {
	IP        net.IP        // IP is the network address (IPv4 or IPv6).
	TimeLeft  time.Duration // TimeLeft specifies the remaining duration before expiration.
	Permanent bool          // Permanent indicates if the IP should remain in the list indefinitely.
}

TempIP represents an entry in a temporary IP list. It combines the network address with its expiration logic.

type TempIPList

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

TempIPList manages a collection of temporary IP addresses. It provides methods for local manipulation of the list before it is serialized and sent to the CommuniGate Pro server.

func (*TempIPList) Add

func (l *TempIPList) Add(input any, duration time.Duration, permanent bool) error

Add updates the local draft by adding or updating an IP address.

Parameters:

  • input: the IP address to add (supported types: string or net.IP).
  • duration: the time-to-live for the entry.
  • permanent: if true, the entry is marked as permanent (TimeLeft is ignored).

Returns:

  • error: an error if the input type is unsupported or the IP is invalid.

func (*TempIPList) Delete

func (l *TempIPList) Delete(input any) error

Delete removes an IP address from the local draft.

Parameters:

  • input: the IP address to remove (supported types: string or net.IP).

Returns:

  • error: an error if the input type is unsupported or the IP is invalid.

func (*TempIPList) Exists

func (l *TempIPList) Exists(input any) (bool, error)

Exists provides a quick check for the presence of an IP in the list.

Parameters:

  • input: the IP address to check (supported types: string or net.IP).

Returns:

  • bool: true if the IP exists in the current list.
  • error: an error if the input IP is invalid.

func (*TempIPList) Get

func (l *TempIPList) Get(input any) (TempIP, bool, error)

Get retrieves the details of a specific IP entry.

Parameters:

  • input: the IP address to look up (supported types: string or net.IP).

Returns:

  • TempIP: the structure containing IP, TimeLeft, and Permanent status.
  • bool: true if the entry was found.
  • error: an error if the input IP is invalid.

func (*TempIPList) IPs

func (l *TempIPList) IPs() []net.IP

IPs exports all IP addresses currently present in the list as a slice.

Returns:

  • []net.IP: a slice of IP addresses. Returns nil if the list is empty.

func (*TempIPList) Len

func (l *TempIPList) Len() int

Len returns the number of entries in the current list.

Returns:

  • int: the total count of IP entries.

type TraceFacility

type TraceFacility string

TraceFacility defines specific server modules available for real-time tracing.

const (
	TraceFileIO TraceFacility = "FileIO" // Record all file read/write/truncate operations
	TraceFileOp TraceFacility = "FileOp" // Record all file create/rename/remove operations
)

Directories

Path Synopsis
cmd
test_account command
test_alert command
test_dir command
test_list command
test_storage command
test_utf8 command

Jump to

Keyboard shortcuts

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