ircpush

command module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 1 Imported by: 0

README

ircpush

Colorizing message forwarder for IRC

ircpush connects to an IRC server and forwards messages received from local inputs (e.g., TCP from rsyslog). It supports per-channel, regex/word-based highlighting with IRC colors, and auto-reconnect.

Build

go build -o ircpush ./...

Configuration

The app searches config in this order:

  1. ./config.yaml (next to the executable)
  2. ~/.ircpush (YAML content)
  3. /etc/ircpush/config.yaml

Example:

tcp:
  listen: "10.20.30.40:9000"

irc:
  server: "irc.example.net:6697"
  tls: true
  tls_skip_verify: false
  nick: "ircbot"
  realname: "ircbot"
  channels: ["#network", "#server", "#security"]

highlight:
  rules:
    - kind: regex
      pattern: "(?i)\\bdrop\\b"
      color: "04,01"
      bold: true
      whole_line: true
      channels: ["#security"]

CLI test client

./ircpush client -c ./config.yaml
  • Type messages; prefix with “#channel ” to target it (e.g. “#security hello”).
  • /quit to exit.

Run TCP listener

./ircpush serve -c ./config.yaml
  • Binds to tcp.listen, reads one line per message.
  • Lines may start with “#channel ” or “#a,#b ” to target channels; otherwise they’re broadcast.
rsyslog example
template(name="IRCHAProxy" type="string" string="#server %hostname%: %programname%%msg%\n")
if ($programname == 'haproxy' and not re_match($msg, '[0-9]+/[0-9]+/[0-9]+/[0-9]+/[0-9]+ 200')) then {
  @@10.20.30.40:12345;IRCHAProxy
}

systemd service (Debian/Ubuntu)

A sample unit is provided in systemd/ircpush.service.

Install:

# Install binary
sudo install -m 0755 ircpush /usr/local/bin/ircpush

# Create user/group and dirs
sudo groupadd --system ircpush || true
sudo useradd --system --no-create-home --home /var/lib/ircpush --shell /usr/sbin/nologin --gid ircpush ircpush || true
sudo install -d -o ircpush -g ircpush -m 0755 /var/lib/ircpush
sudo install -d -o root -g root -m 0755 /etc/ircpush

# Config
sudo cp ./config.yaml /etc/ircpush/config.yaml

# Unit
sudo cp ./systemd/ircpush.service /etc/systemd/system/ircpush.service
sudo systemctl daemon-reload
sudo systemctl enable --now ircpush.service
systemctl status ircpush.service

Optional env overrides:

# /etc/default/ircpush
IRCPUSH_TCP_LISTEN="10.20.30.40:9000"

Test listener:

echo '#server hello from nc' | nc 10.20.30.40 9000

Reloading configuration

ircpush supports live reload of highlight rules:

  • Automatic: editing the active config file triggers reload (inotify).
  • Manual: systemctl reload ircpush sends SIGHUP to reload.

Notes:

  • Highlight rules are hot-reloaded.
  • Changing tcp.listen or core IRC settings currently requires a restart: sudo systemctl restart ircpush

Documentation

Overview

MIT License

Copyright (c) 2025 Mikael Schultz <mikael@conf-t.se>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
MIT License
MIT License
pkg
config
MIT License
MIT License
highlight
MIT License
MIT License
inputs/tcp
MIT License
MIT License
irc
MIT License
MIT License

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL