# marketsquare/sshlibrary architecture

> Architecture diagram of the GitHub repository marketsquare/sshlibrary, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marketsquare/sshlibrary
- Repository: https://github.com/marketsquare/sshlibrary

## Overview

SSHLibrary is a Robot Framework library whose keywords open and manage SSH connections, then perform remote command execution, interactive-shell I/O, and SFTP/SCP transfers. The map separates that keyword API from connection, configuration, and logging support, and includes local port forwarding. The README establishes the product capabilities; source excerpts show representative command, transfer, configuration, and forwarding behavior. Some implementation details are unsampled, so only documented or indexed relationships are shown.

Main entry points: [`src/SSHLibrary/library.py`](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/library.py) (Keyword API), [`src/SSHLibrary/client.py`](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py) (SSH Client), [`src/SSHLibrary/pythonforward.py`](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/pythonforward.py) (Port Forwarding), [`src/SSHLibrary/config.py`](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/config.py) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Robot Keywords"]
  node_library["Keyword API<br/>[library.py]"]
end

subgraph group_session["SSH Sessions"]
  node_connection["SSH Client<br/>[client.py]"]
  node_interactive["Interactive Shell<br/>[client.py]"]
  node_commands["Remote Commands<br/>[client.py]"]
  node_forwarding["Port Forwarding<br/>[pythonforward.py]"]
end

subgraph group_transfer["File Transfer"]
  node_sftp["SFTP Operations<br/>[client.py]"]
  node_scp["SCP Operations<br/>[client.py]"]
end

subgraph group_support["Runtime Support"]
  node_config["Configuration<br/>[config.py]"]
  node_cache["Connection Cache"]
  node_logger["Logging<br/>[logger.py]"]
  node_version["Version<br/>[version.py]"]
end

node_robot(("Robot Framework"))
node_remote{{"Remote Host"}}
node_localfiles[("Local Filesystem")]

node_robot -->|"invokes keywords"| node_library
node_library -->|"dispatches operations"| node_connection
node_library -->|"uses connections"| node_cache
node_library -->|"configures defaults"| node_config
node_library -->|"logs activity"| node_logger
node_connection -->|"reads settings"| node_config
node_connection -->|"provides shell I/O"| node_interactive
node_library -->|"starts and reads"| node_commands
node_connection -->|"executes commands"| node_commands
node_library -->|"dispatches transfers"| node_sftp
node_connection -->|"opens SFTP"| node_sftp
node_library -->|"selects SCP transfers"| node_scp
node_connection -->|"creates SCP client"| node_scp
node_connection -->|"uses forwarding"| node_forwarding
node_interactive -->|"reads and writes"| node_remote
node_commands -->|"runs commands"| node_remote
node_sftp -->|"transfers files"| node_remote
node_scp -->|"transfers files"| node_remote
node_sftp -->|"reads and writes"| node_localfiles
node_scp -->|"reads and writes"| node_localfiles
node_forwarding -->|"forwards traffic"| node_remote

click node_library "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/library.py"
click node_connection "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py"
click node_config "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/config.py"
click node_cache "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/sshconnectioncache.py"
click node_interactive "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py"
click node_commands "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py"
click node_sftp "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py"
click node_scp "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py"
click node_forwarding "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/pythonforward.py"
click node_logger "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/logger.py"
click node_version "https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/version.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_library toneBlue
class node_connection,node_interactive,node_commands,node_forwarding,node_localfiles toneAmber
class node_sftp,node_scp toneMint
class node_config,node_cache,node_logger,node_version toneRose
class node_robot,node_remote toneIndigo
```

## Components

### Robot Keywords

- [Keyword API](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/library.py): `src/SSHLibrary/library.py`

### SSH Sessions

- [SSH Client](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py): `src/SSHLibrary/client.py`
- [Interactive Shell](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py): `src/SSHLibrary/client.py`
- [Remote Commands](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py): `src/SSHLibrary/client.py`
- [Port Forwarding](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/pythonforward.py): `src/SSHLibrary/pythonforward.py`

### File Transfer

- [SFTP Operations](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py): `src/SSHLibrary/client.py`
- [SCP Operations](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/client.py): `src/SSHLibrary/client.py`

### Runtime Support

- [Configuration](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/config.py): `src/SSHLibrary/config.py`
- [Connection Cache](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/sshconnectioncache.py): `src/SSHLibrary/sshconnectioncache.py`
- [Logging](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/logger.py): `src/SSHLibrary/logger.py`
- [Version](https://github.com/marketsquare/sshlibrary/blob/master/src/SSHLibrary/version.py): `src/SSHLibrary/version.py`

### Other components

- **Robot Framework**
- **Remote Host**
- **Local Filesystem**

## Connections

- Robot Framework → Keyword API: invokes keywords (evidence: `README.rst`)
- Keyword API → SSH Client: dispatches operations (evidence: `src/SSHLibrary/library.py`)
- Keyword API → Connection Cache: uses connections (evidence: `src/SSHLibrary/library.py`)
- Keyword API → Configuration: configures defaults (evidence: `src/SSHLibrary/library.py`)
- Keyword API → Logging: logs activity (evidence: `src/SSHLibrary/library.py`)
- SSH Client → Configuration: reads settings (evidence: `src/SSHLibrary/client.py`)
- SSH Client → Interactive Shell: provides shell I/O (evidence: `src/SSHLibrary/client.py`)
- Keyword API → Remote Commands: starts and reads (evidence: `src/SSHLibrary/library.py`)
- SSH Client → Remote Commands: executes commands (evidence: `README.rst`)
- Keyword API → SFTP Operations: dispatches transfers (evidence: `src/SSHLibrary/library.py`)
- SSH Client → SFTP Operations: opens SFTP (evidence: `src/SSHLibrary/client.py`)
- Keyword API → SCP Operations: selects SCP transfers (evidence: `src/SSHLibrary/library.py`)
- SSH Client → SCP Operations: creates SCP client (evidence: `src/SSHLibrary/client.py`)
- SSH Client → Port Forwarding: uses forwarding (evidence: `src/SSHLibrary/client.py`)
- Interactive Shell → Remote Host: reads and writes (evidence: `README.rst`)
- Remote Commands → Remote Host: runs commands (evidence: `README.rst`)
- SFTP Operations → Remote Host: transfers files (evidence: `README.rst`)
- SCP Operations → Remote Host: transfers files (evidence: `src/SSHLibrary/client.py`)
- SFTP Operations → Local Filesystem: reads and writes (evidence: `src/SSHLibrary/client.py`)
- SCP Operations → Local Filesystem: reads and writes (evidence: `src/SSHLibrary/client.py`)
- Port Forwarding → Remote Host: forwards traffic (evidence: `src/SSHLibrary/pythonforward.py`)
