ircflu

command module
v0.0.0-...-31a8ea0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 17 Imported by: 0

README

ircflu

ircflu is an IRC bot written in Go with a flexible message- & command-handler. Among its advanced features are a cat-server which allows you to forward incoming messages from a TCP socket straight to an IRC channel, and an integrated HTTP server ready to process incoming JSON-API calls.

At Tomahawk (http://tomahawk-player.org) we're all pretty much addicted to IRC. We use it not only to coordinate our development efforts and communicate, but also to get alerted about source code changes on GitHub, when a ticket gets updated or a service on our servers runs into an issue. We can even use it to trigger commands being executed on our servers, e.g. to deploy the latest source code.

ircflu can do all that for us... except the communicating. It's not that kind of chatbot.

Installation

Make sure you have a working Go environment. See the install instructions.

First we need to get the required dependencies. ircflu itself is part of that list so the main executable can depend on our sub-packages:

go get -u github.com/muesli/ircflu

Now we can build ircflu:

git clone git://github.com/muesli/ircflu.git
cd ircflu
go build

To run the application you will need to specify at least a few parameters:

./ircflu -irchost="some.server:6667" -ircchannel="#ircflu"

You can control which commands you want to be enabled with the '-commands' option. Be aware that enabling the 'exec' command allows authenticated users to remotely execute arbitrary commands on your machine! To start ircflu with all currently available commands run:

./ircflu -commands="alias,auth,exec,join,part,send" -authpassword="some_password" -irchost="some.server:6667" -ircchannel="#ircflu"

Run ircflu -help to see a full list of options!

Make it talk on IRC

When started with its default options, ircflu will listen for incoming connections on TCP port 12345. You can now send messages to an IRC channel from your favorite shell script or a terminal:

echo "This will be sent to the default channel on IRC." | netcat -q0 127.0.0.1 12345
echo "#somechannel This will be sent to a specific channel on IRC." | netcat -q0 127.0.0.1 12345
echo "#* This will be sent to all joined IRC channels." | netcat -q0 127.0.0.1 12345
echo "@someuser This will be sent to a specific user on IRC." | netcat -q0 127.0.0.1 12345

Remote controlling ircflu

It comes with a simplistic authentication system (!auth), supports aliases for commands (!alias) and executing external applications (!exec), forwarding their output to IRC.

To authenticate with ircflu, use the auth command in a private query with it:

!auth [your_auth_password]

Once you're authed, you can execute a command on ircflu's host:

!exec /usr/local/bin/some_executable

You can also make it join or part IRC channels:

!join #test
!part #test

Here's how you can create and use aliases:

!alias deploy = exec ssh myserver ~/deploy.sh
!deploy

Integrated web hooks support

ircflu also runs an integrated HTTP server on port 12346, processing incoming GitHub (on /github) & GitLab (on /gitlab) web-hook calls which are triggered by a commit to your git repository.

To connect GitHub with ircflu, go to your repository's settings page, click on 'Service Hooks' and then pick 'WebHook URLs' from the list. Add a new web-hook here, e.g.: 'http://your.ircflu.host:12346/github'

Whenever you push something to your repository now, ircflu will post a nice little summary of your changes on IRC.

Development

API docs can be found here.

Continuous integration: Build Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
ircflu's application container.
ircflu's application container.
The auth module is responsible for managing client authentications.
The auth module is responsible for managing client authentications.
ircflu's central commands controller and dispatcher.
ircflu's central commands controller and dispatcher.
alias
The alias command lets you create shortcuts to lengthy commands.
The alias command lets you create shortcuts to lengthy commands.
auth
The auth command lets clients authenticate to unlock secured commands.
The auth command lets clients authenticate to unlock secured commands.
exec
The exec command lets you remotely execute arbitrary commands.
The exec command lets you remotely execute arbitrary commands.
join
The join command makes ircflu join another channel.
The join command makes ircflu join another channel.
part
The part command makes ircflu part a joined channel.
The part command makes ircflu part a joined channel.
send
The send command makes ircflu talk on an IRC channel.
The send command makes ircflu talk on an IRC channel.
ircflu's central messaging system.
ircflu's central messaging system.
catserver
Based on gocat's catserver by Richard Jones - https://github.com/RJ/gocat Listens on a TCP port, parses first line for addressees, puts Message onto the out channel.
Based on gocat's catserver by Richard Jones - https://github.com/RJ/gocat Listens on a TCP port, parses first line for addressees, puts Message onto the out channel.
irc
ircflu's IRC client subsystem.
ircflu's IRC client subsystem.
irc/irctools
A collection of convenient IRC styling methods.
A collection of convenient IRC styling methods.
jabber
ircflu's Jabber subsystem.
ircflu's Jabber subsystem.
web
ircflu's integrated web-server to handle web-hooks.
ircflu's integrated web-server to handle web-hooks.
web/hooks
ircflu's web-hook subsystem.
ircflu's web-hook subsystem.
web/hooks/github
A GitHub web-hook sending messages when new commits arrive.
A GitHub web-hook sending messages when new commits arrive.
web/hooks/gitlab
A GitLab web-hook sending messages when new commits arrive.
A GitLab web-hook sending messages when new commits arrive.
web/hooks/jira
A Jira web-hook sending messages when new commits arrive.
A Jira web-hook sending messages when new commits arrive.

Jump to

Keyboard shortcuts

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