go-sendxmpp/README.md

155 lines
5.2 KiB
Markdown
Raw Normal View History

2018-08-04 10:16:28 +00:00
# go-sendxmpp
## about
A little tool to send messages to an XMPP contact or MUC inspired by [sendxmpp](https://sendxmpp.hostname.sk/).
You can find other sendxmpp alternatives in the [XSF wiki](https://wiki.xmpp.org/web/User:MDosch/Sendxmpp_incarnations).
2018-08-04 10:16:28 +00:00
2021-01-29 17:09:58 +00:00
## support
You might join the [chat](https://join.jabber.network/#go-sendxmpp@chat.mdosch.de?join) if you have problems,
want to contribute or just want to talk about the project. You might also talk about any of the other
sendxmpp incarnations. :)
2021-09-09 09:35:21 +00:00
[![Go-sendxmpp MUC badge](https://chat.mdosch.de:5281/muc_badge/go-sendxmpp@chat.mdosch.de)](https://join.jabber.network/#go-sendxmpp@chat.mdosch.de?join)
2018-08-04 10:16:28 +00:00
## requirements
* [go](https://golang.org/)
## installation
### repositories including go-sendxmpp
[![Packaging status](https://repology.org/badge/vertical-allrepos/go:sendxmpp.svg)](https://repology.org/project/go:sendxmpp/versions)
### manual installation
#### Go < 1.16
2018-08-04 10:16:28 +00:00
2018-08-10 10:14:21 +00:00
```plain
2021-11-02 12:48:39 +00:00
$ go get -u salsa.debian.org/mdosch/go-sendxmpp
```
#### Go >= 1.16
2021-11-02 12:48:39 +00:00
2022-02-25 07:42:02 +00:00
Latest release:
2021-11-02 12:48:39 +00:00
```plain
$ go install salsa.debian.org/mdosch/go-sendxmpp@latest
2018-08-04 10:16:28 +00:00
```
2022-02-25 07:42:02 +00:00
Current development version:
```plain
$ go install salsa.debian.org/mdosch/go-sendxmpp@master
```
2018-08-04 10:16:28 +00:00
You will find the binary in `$GOPATH/bin` or, if set, `$GOBIN`.
### binaries
There are some (automatically built and untested) binaries linked to the
[release](https://salsa.debian.org/mdosch/go-sendxmpp/-/releases).
2018-08-04 10:16:28 +00:00
## usage
2018-08-10 11:53:42 +00:00
You can either pipe a programs output to `go-sendxmpp`, write in your terminal (put \^D in a new
line to finish) or send the input from a file (`-m` or `--message`).
2018-08-04 10:16:28 +00:00
2022-02-22 18:57:03 +00:00
The account data is expected at `~/.config/go-sendxmpp/config` if no other configuration file location
2021-03-10 08:56:41 +00:00
is specified with `-f` or `--file`. The configuration file is expected to be in the following format:
2018-08-04 10:16:28 +00:00
2018-08-10 10:14:21 +00:00
```plain
username: <your_jid>
2018-08-10 10:14:21 +00:00
password: <your_jabber_password>
```
2018-08-04 10:16:28 +00:00
2021-03-03 10:39:20 +00:00
If this is not sufficient to connect you might also specify `jserver` and `port`. It is also possible to
2020-10-01 16:55:41 +00:00
use a password manager. In this case the `password` setting should be replaced by the `eval_password`
setting:
```
eval_password: <command_to_unlock_your_password>
```
2021-06-26 08:05:47 +00:00
You can also configure the resource (and nickname for MUCs) via the `resource` setting:
```
2022-02-15 17:03:34 +00:00
resource: <my_resource>
2021-06-26 08:05:47 +00:00
```
2020-10-01 16:55:41 +00:00
If no configuration file is present or if the values should be overridden it is possible to define
the account details via command line options:
2018-08-10 10:14:21 +00:00
```plain
2022-04-18 09:16:41 +00:00
Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value] [-m value] [--muc-password value] [--ox] [--ox-genprivkey] [--ox-import-privkey value] [--ox-passphrase value] [-p value] [--raw] [-r value] [--timeout value] [--tls-version value] [-u value] [--version] [parameters ...]
2018-12-15 15:15:30 +00:00
-c, --chatroom Send message to a chatroom.
-d, --debug Show debugging info.
2022-02-07 15:19:30 +00:00
-f, --file=value Set configuration file. (Default:
~/.config/go-sendxmpp/sendxmpprc)
--help Show help.
2020-04-10 09:21:17 +00:00
--http-upload=value
Send a file via http-upload.
-i, --interactive Interactive mode (for use with e.g. 'tail -f').
2018-08-10 10:14:21 +00:00
-j, --jserver=value
XMPP server address.
2022-02-07 15:19:30 +00:00
-l, --listen Listen for messages and print them to stdout.
-m, --message=value
Set file including the message.
--muc-password=value
Password for password protected MUCs.
-n, --no-tls-verify
Skip verification of TLS certificates (not recommended).
--ox Use "OpenPGP for XMPP" encryption (experimental).
--ox-genprivkey
Generate a public OpenPGP key for the given JID and publish
the corresponding public key.
2022-04-18 09:16:41 +00:00
--ox-import-privkey=value
Import an existing private OpenPGP key.
--ox-passphrase=value
Passphrase for locking and unlocking the private OpenPGP
key.
2018-08-10 10:14:21 +00:00
-p, --password=value
Password for XMPP account.
2022-02-07 15:19:30 +00:00
--raw Send raw XML.
2018-08-10 10:14:21 +00:00
-r, --resource=value
Set resource. When sending to a chatroom this is used as
'alias'.
2022-02-12 08:18:02 +00:00
--timeout=value
Connection timeout in seconds. [10]
2021-01-21 10:19:55 +00:00
-t, --tls Use direct TLS.
--tls-version=value
Minimal TLS version. 10 (TLSv1.0), 11 (TLSv1.1), 12
(TLSv1.2) or 13 (TLSv1.3). [12]
2018-08-10 10:14:21 +00:00
-u, --username=value
2021-01-29 17:41:25 +00:00
Username for XMPP account.
2022-02-12 10:16:45 +00:00
--version Show version information.
2018-08-04 10:16:28 +00:00
```
### examples
2018-08-10 10:14:21 +00:00
Send a message to two recipients using a configuration file.
2018-08-04 10:16:28 +00:00
```bash
2018-08-10 10:14:21 +00:00
cat message.txt | ./go-sendxmpp -f ./sendxmpp recipient1@example.com recipient2@example.com
2018-08-04 10:16:28 +00:00
```
2018-08-10 10:14:21 +00:00
Send a message to two recipients directly defining account credentials.
2018-08-04 10:16:28 +00:00
```bash
2018-08-10 10:14:21 +00:00
cat message.txt | ./go-sendxmpp -u bob@example.com -j example.com -p swordfish recipient1@example.com recipient2@example.com
2018-08-04 10:16:28 +00:00
```
2018-08-10 10:14:21 +00:00
Send a message to two groupchats (`-c`) using a configuration file.
```bash
cat message.txt | ./go-sendxmpp -cf ./sendxmpp chat1@conference.example.com chat2@conference.example.com
```
Send file changes to two groupchats (`-c`) using a configuration file.
```bash
tail -f example.log | ./go-sendxmpp -cif ./sendxmpp chat1@conference.example.com chat2@conference.example.com
2018-12-15 15:15:30 +00:00
```