Coder Social home page Coder Social logo

udpt's Introduction

udpt

UDP Transport

Go Report Card godoc License: MIT

Compresses, encrypts and transfers data between a sender and receiver using UDP protocol.

Features and Design Aims:

  • Avoid the overhead of establishing a TCP or TCP+TLS handshake.
  • Reliable transfer of data using an unreliable UDP connection.
  • Uses AES-256 symmetric cipher for encryption.
  • Uses zlib library for data compression.
  • No third-party dependencies. Only uses the standard library.
  • Readable, understandable code with explanatory comments.

Installation:

    go get github.com/balacode/udpt

Hello World:

This demo starts a Receiver which listens for incoming data, then sends a "Hello World" to the receiver using Sender.SendString().

package main

import (
    "fmt"

    "github.com/balacode/udpt"
)

// main demo
func main() {
    // secret encryption key shared by the Sender and Receiver
    cryptoKey := []byte("aA2Xh41FiC4Wtj3e5b2LbytMdn6on7P0")
    //
    // set-up and run the receiver
    rc := udpt.Receiver{Port: 9876, CryptoKey: cryptoKey,
        Receive: func(k string, v []byte) error {
            fmt.Println("Received k:", k, "v:", string(v))
            return nil
        }}
    go func() { _ = rc.Run() }()
    //
    // send a message to the receiver
    err := udpt.SendString("127.0.0.1:9876", "main", "Hello World!", cryptoKey)
    if err != nil {
        fmt.Println("failed sending:", err)
    }
    rc.Stop()
} //                                                                        main

Security Notice:

This is a new project and its use of cryptography has not been reviewed by experts. While I make use of established crypto algorithms available in the standard Go library and would not "roll my own" encryption, there may be weaknesses in my application of the algorithms. Please use caution and do your own security asessment of the code. At present, this library uses AES-256 in Galois Counter Mode to encrypt each packet of data, including its headers, and SHA-256 for hashing binary resources that are being transferred.

Version History:

This project is in its DRAFT stage: very unstable. At this point it works, but the API may change rapidly.

Ideas:

  • Create a drop-in replacement for TCP and TLS connections
  • Implement some form of transfer control
  • Improve performance

udpt's People

Contributors

balacode avatar cassianodev avatar deepsourcebot avatar

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.