Skip to content

Daemon to bridge between two instant messaging protocols

License

Notifications You must be signed in to change notification settings

AndreiRegiani/im2im

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

im2im

Daemon to bridge between two instant messaging protocols.

The service listens for incoming messages on a given protocol and forwards them to another protocol. It's designed to be extensible to support the addition of new protocols and configuring their usage via a configuration file (YAML), any amount of bridges can be run at the same time within the same process.

Supported protocols

  • TCP
  • Telegram Bot

Overview

Example for sending and receiving messages between TCP socket ⇔ Telegram Bot API, using a microcontroller (thin client) in LAN with a Raspberry Pi (running im2im):

Alt text

im2im.yaml

bridges:
  bridge1:
      from:
        tcp:
          host: ""  # daemon listens on all interfaces (reachable in LAN)
          port: 9001
      to:
        telegram_bot:
          token: ABCDEFGHIJKLMNOPQRSTUVWXYZ
          chat_id: 123456789
  bridge2:
    from:
      telegram_bot:
          token: ABCDEFGHIJKLMNOPQRSTUVWXYZ
          chat_id: 123456789
    to:
      tcp:
          host: 192.168.1.50  # microcontroller IP address in LAN
          port: 9002

Installation

From source

make build

Docker

make docker-build

Usage

Configuration

cp im2im.yaml.example im2im.yaml

Minimal example:

bridges:
  bridge0:
      from:
        tcp:
          host: localhost
          port: 9001
      to:
        tcp:
          host: localhost
          port: 9002

Connecting

Using Netcat as TCP client and server.

nc -l 9002  # server
make run  # daemon
nc localhost 9001  # client

Implementation

  • Go 1.20, each bridge spawns two goroutines (sender/receiver) and uses one channel to pass the message.

Contributing

See CONTRIBUTING.md for submitting pull requests.

License

MIT License Copyright (c) 2023 Andrei Regiani

About

Daemon to bridge between two instant messaging protocols

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published