Coder Social home page Coder Social logo

andreiregiani / im2im Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 373 KB

Daemon to bridge between two instant messaging protocols

License: MIT License

Go 87.06% Dockerfile 2.02% Makefile 10.92%
arduino embedded esp32 golang instant-messaging networking raspberry-pi sbc telegram telegram-bot

im2im's Introduction

im2im

Proof of Concept: 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.