Initial commit

This commit is contained in:
DataHoarder 2023-08-06 02:14:19 +02:00
commit b375f3c2a4
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
5 changed files with 321 additions and 0 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
.git/
matterbridge.toml
matterbridge.toml.example
.gitignore
docker-compose.override.yml

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
matterbridge.toml

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM golang:1.21-rc-alpine3.18 AS builder
ENV CGO_ENABLED="0"
WORKDIR /usr/src/matterbridge
ARG GOPROXY=""
ENV GOPROXY=${GOPROXY}
COPY . .
RUN GOBIN=/usr/bin go install -v \
-tags withoutsteam,withoutapi,withoutxmpp,withoutrocketchat,withoutmattermost,withoutmsteams,withoutzulip,withoutkeybase,withoutnctalk,withoutslack,withoutsshchat,withoutwhatsapp,withoutvk,withoutdiscord,withouttelegram,withoutmumble,withoutharmony \
github.com/42wim/matterbridge@v1.26.0
FROM alpine:3.18
ARG BUILD_BINARY
COPY --from=builder /usr/bin/${BUILD_BINARY} /usr/bin/${BUILD_BINARY}
RUN apk --no-cache add ca-certificates mailcap
RUN mkdir /etc/matterbridge \
&& touch /etc/matterbridge/matterbridge.toml \
&& ln -sf /matterbridge.toml /etc/matterbridge/matterbridge.toml
ENTRYPOINT ["/usr/bin/matterbridge", "-conf", "/etc/matterbridge/matterbridge.toml"]

23
docker-compose.yml Normal file
View file

@ -0,0 +1,23 @@
version: "2.2"
networks:
p2pool-observer-bridge:
external: false
volumes:
data:
external: false
services:
bot:
build:
context: ./
dockerfile: ./Dockerfile
args:
- GOPROXY=${GOPROXY}
restart: always
security_opt:
- no-new-privileges:true
volumes:
- ./matterbridge.toml:/etc/matterbridge/matterbridge.toml:ro
networks:
- p2pool-observer-bridge

263
matterbridge.toml.example Normal file
View file

@ -0,0 +1,263 @@
[irc]
[irc.libera]
Server="irc.libera.chat:6697"
Password=""
UseTLS=true
UseSASL=false
SkipTLSVerify=false
Charset="utf-8"
Nick="p2pool-relay"
RealName="Matterbridge"
UserName="p2pool-relay"
NickServNick="NickServ"
NickServPassword="PASSWORD_HERE"
## RELOADABLE SETTINGS
## Settings below can be reloaded by editing the file
#Flood control
#Delay in milliseconds between each message send to the IRC server
#OPTIONAL (default 1300)
MessageDelay=1300
#Maximum amount of messages to hold in queue. If queue is full
#messages will be dropped.
#<clipped message> will be add to the message that fills the queue.
#OPTIONAL (default 30)
MessageQueue=30
#Maximum length of message sent to irc server. If it exceeds
#<clipped message> will be add to the message.
#OPTIONAL (default 400)
MessageLength=400
#Split messages on MessageLength instead of showing the <clipped message>
#WARNING: this could lead to flooding
#OPTIONAL (default false)
MessageSplit=false
#Message to show when a message is too big
#Default "<clipped message>"
MessageClipped="<clipped message>"
#Delay in seconds to rejoin a channel when kicked
#OPTIONAL (default 0)
RejoinDelay=5
#ColorNicks will show each nickname in a different color.
#Only works in IRC right now.
ColorNicks=true
#RunCommands allows you to send RAW irc commands after connection.
#The string {BOTNICK} (case sensitive) will be replaced with the bot's current nickname.
RunCommands=["MODE {BOTNICK} +B"]
#PingDelay specifies how long to wait to send a ping to the irc server.
PingDelay="1m"
#StripMarkdown strips markdown from messages
StripMarkdown=false
#Nicks you want to ignore.
IgnoreNicks="bridgerton bridgeton[m]"
#Messages you want to ignore.
#Messages matching these regexp will be ignored and not sent to other bridges
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
IgnoreMessages=""
#messages you want to replace.
#it replaces outgoing messages from the bridge.
#so you need to place it by the sending bridge definition.
#regular expressions supported
#some examples:
#this replaces cat => dog and sleep => awake
#replacemessages=[ ["cat","dog"], ["sleep","awake"] ]
#this replaces every number with number. 123 => numbernumbernumber
#replacemessages=[ ["[0-9]","number"] ]
ReplaceMessages=[]
#nicks you want to replace.
#see replacemessages for syntaxa
ReplaceNicks=[]
#Extractnicks is used to for example rewrite messages from other relaybots
#See https://github.com/42wim/matterbridge/issues/713 and https://github.com/42wim/matterbridge/issues/466
#some examples:
#this replaces a message like "Relaybot: <relayeduser> something interesting" to "relayeduser: something interesting"
#ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ] ]
#you can use multiple entries for multiplebots
#this also replaces a message like "otherbot: (relayeduser) something else" to "relayeduser: something else"
#ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ],[ "otherbot","\\((.*?)\\)\\s+" ]
ExtractNicks=[]
#extra label that can be used in the RemoteNickFormat
Label=""
#RemoteNickFormat defines how remote users appear on this bridge
#See [general] config section for default options
#The string "{NOPINGNICK}" (case sensitive) will be replaced by the actual nick / username, but with a ZWSP inside the nick, so the irc user with the same nick won't get pinged. See https://github.com/42wim/matterbridge/issues/175 for more information
RemoteNickFormat="<{NICK}> "
#Enable to show users joins/parts from other bridges
#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
ShowJoinPart=true
#Enable to show verbose users joins/parts (ident@host) from other bridges
#Currently works for messages from the following bridges: irc
VerboseJoinPart=true
#Do not send joins/parts to other bridges
#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
NoSendJoinPart=false
#StripNick only allows alphanumerical nicks. See https://github.com/42wim/matterbridge/issues/285
#It will strip other characters from the nick
StripNick=false
#Enable to show topic changes from other bridges
#Only works hiding/show topic changes from slack bridge for now
ShowTopicChange=false
#Delay in milliseconds between channel joins
#Only useful when you have a LOT of channels to join
#See https://github.com/42wim/matterbridge/issues/1084
JoinDelay=0
UseRelayMsg=false
###################################################################
#matrix section
###################################################################
[matrix]
#You can configure multiple servers "[matrix.name]" or "[matrix.name2]"
#In this example we use [matrix.neo]
#REQUIRED
[matrix.monero]
Server="https://matrix.monero.social"
#Authentication for your bot.
#You can use either login/password OR mxid/token. The latter will be preferred if found.
#Use a dedicated user for this and not your own!
#Messages sent from this user will not be relayed to avoid loops.
#REQUIRED
Login="p2pool-relay"
Password="PASSWORD_HERE"
#Whether to send the homeserver suffix. eg ":matrix.org" in @username:matrix.org
#to other bridges, or only send "username".(true only sends username)
NoHomeServerSuffix=false
#Whether to disable sending of HTML content to matrix
#See https://github.com/42wim/matterbridge/issues/1022
HTMLDisable=false
## RELOADABLE SETTINGS
## Settings below can be reloaded by editing the file
# UseUserName shows the username instead of the server nickname
UseUserName=true
# Matrix quotes replies and as of matterbridge 1.24.0 we strip those as this causes
# issues with bridges support threading and have PreserveThreading enabled.
# But if you for example use mattermost or discord with webhooks you'll need to enable
# this (and keep PreserveThreading disabled) if you want something that looks like a reply from matrix.
# See issues:
# - https://github.com/42wim/matterbridge/issues/1819
# - https://github.com/42wim/matterbridge/issues/1780
KeepQuotedReply=false
#Nicks you want to ignore.
#Regular expressions supported
#Messages from those users will not be sent to other bridges.
IgnoreNicks=""
#Messages you want to ignore.
#Messages matching these regexp will be ignored and not sent to other bridges
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
IgnoreMessages=""
#messages you want to replace.
#it replaces outgoing messages from the bridge.
#so you need to place it by the sending bridge definition.
#regular expressions supported
#some examples:
#this replaces cat => dog and sleep => awake
#replacemessages=[ ["cat","dog"], ["sleep","awake"] ]
#this replaces every number with number. 123 => numbernumbernumber
#replacemessages=[ ["[0-9]","number"] ]
ReplaceMessages=[]
#nicks you want to replace.
#see replacemessages for syntaxa
ReplaceNicks=[]
#Extractnicks is used to for example rewrite messages from other relaybots
#See https://github.com/42wim/matterbridge/issues/713 and https://github.com/42wim/matterbridge/issues/466
#some examples:
#this replaces a message like "Relaybot: <relayeduser> something interesting" to "relayeduser: something interesting"
#ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ] ]
#you can use multiple entries for multiplebots
#this also replaces a message like "otherbot: (relayeduser) something else" to "relayeduser: something else"
#ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ],[ "otherbot","\\((.*?)\\)\\s+" ]
#OPTIONAL (default empty)
ExtractNicks=[]
#extra label that can be used in the RemoteNickFormat
#optional (default empty)
Label=""
#RemoteNickFormat defines how remote users appear on this bridge
#See [general] config section for default options
RemoteNickFormat="<{NICK}> "
#Enable to show users joins/parts from other bridges
#Currently works for messages from the following bridges: irc, mattermost, mumble, slack, discord
ShowJoinPart=true
#Rename the bot in the current room to the username of the message
#This will make an additional API request per message and will probably count towards rate limits
SpoofUsername=false
StripNick=false
ShowTopicChange=true
###################################################################
#Gateway configuration
###################################################################
[[gateway]]
name="gateway-p2pool-log"
enable=true
inout = [
{ account="irc.libera", channel="#p2pool-log", options={key=""}},
{ account="matrix.monero", channel="#p2pool-log:monero.social" },
]
[[gateway]]
name="gateway-p2pool-observer"
enable=true
inout = [
{ account="irc.libera", channel="#p2pool-observer", options={key=""}},
{ account="matrix.monero", channel="#p2pool-observer:monero.social" },
]
[[gateway]]
name="gateway-p2pool-main"
enable=true
inout = [
{ account="irc.libera", channel="#p2pool-main", options={key=""}},
{ account="matrix.monero", channel="#p2pool-main:monero.social" },
]
[[gateway]]
name="gateway-p2pool-mini"
enable=true
inout = [
{ account="irc.libera", channel="#p2pool-mini", options={key=""}},
{ account="matrix.monero", channel="#p2pool-mini:monero.social" },
]