MCPcopy Index your code
hub / github.com/alegrey91/fwdctl

github.com/alegrey91/fwdctl @v1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1 ↗ · + Follow
110 symbols 267 edges 39 files 18 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

fwdctl

<img src="https://github.com/alegrey91/fwdctl/raw/v1.1/fwdctl.png" alt="fwdctl" width="200"/>

Go Reference Go Report Card Go Coverage https://img.shields.io/ossf-scorecard/github.com/alegrey91/fwdctl?label=openssf%20scorecard&style=flat Awesome

fwdctl is a simple and intuitive CLI to manage forwards in your Linux server.

How it works

It essentially provides commands to manage forwards, using iptables under the hood.

Let's do an example:

Suppose you have an hypervisor server that hosts some virtual machines inside itself. If you need to expose an internal service, managed by one of these VMs, you can use fwdctl from the hypervisor to add the forward to expose this service.

example

To do so, you have to type this easy command:

sudo fwdctl create --destination-port 3000 --source-address 192.168.199.105 --source-port 80

That's it.

Full documentation here.

Installation

Linux x86_64

curl -s https://raw.githubusercontent.com/alegrey91/fwdctl/main/install | sudo sh

Seccomp (experimental)

I've recently added a new functionality to trace the system calls used by fwdctl during the test pipeline.

This is done by using another project of mine: harpoon.

Thanks to this, at the end of the pipeline, we have a seccomp profile as artifact. You can use this to run fwdctl in a more secure way.

Find the seccomp profile here: fwdctl-seccomp.json.

Extension points exported contracts — how you extend this code

Printer (Interface)
(no doc) [3 implementers]
internal/printer/printer_interface.go
Generator (Interface)
(no doc) [3 implementers]
internal/template/template.go

Core symbols most depended-on inside this repo

NewRuleSetFromFile
called by 7
internal/rules/ruleset.go
String
called by 6
pkg/iptables/rule.go
ExtractRuleInfo
called by 5
pkg/iptables/rule.go
NewIPTablesInstance
called by 5
pkg/iptables/forward.go
CreateForward
called by 4
pkg/iptables/forward.go
hash
called by 3
internal/rules/ruleset.go
GenerateTemplate
called by 3
internal/template/template.go
interfaceExists
called by 2
pkg/iptables/interface.go

Shape

Function 61
Method 30
Struct 16
Interface 2
TypeAlias 1

Languages

Go100%

Modules by API surface

pkg/iptables/forward.go8 symbols
internal/template/template_test.go8 symbols
internal/rules/ruleset.go8 symbols
internal/template/systemd_template/systemd_service.go7 symbols
internal/template/template.go6 symbols
internal/template/rules_template/rules.go6 symbols
utils.go5 symbols
pkg/iptables/validation.go5 symbols
pkg/iptables/rule.go4 symbols
internal/daemon/management.go4 symbols
pkg/iptables/rule_test.go3 symbols
internal/template/systemd_template/systemd_service_test.go3 symbols

For agents

$ claude mcp add fwdctl \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact