Code Monkey home page Code Monkey logo

snf4j's Introduction

MIT License Build project Coverage Status

Introduction

The Simple Network Framework for Java (SNF4J) is an asynchronous event-driven network application framework for quick and easy development of network applications.

The SNF4J serves as a simple, lightweight and independent network application framework helping in developing high performance and scalable network applications. It provides an asynchronous API via the Java NIO to handle various transports like TCP/IP, UDP/IP and SCTP/IP.

The framework is designed to be simple in use and moderately easy to understand. Application developers that like to keep their ear to the ground will not be overwhelmed by a tone of source code. It is oriented towards delivering core networking functionality as transferring data between two or more communicating network applications in a simple but effective way. To provide privacy and integrity of transferred data it provides support for the SSL/TLS/DTLS protocols.

Design

  • Unified API for transport layer types: TCP, UDP and SCTP
  • Event-driven API for developing asynchronous network applications
  • Customizable protocol engines for transport layer types: TCP and UDP
  • Utilities for development of UDP server applications
  • Simple API for customizable encoder-decoder pipelines
  • Provide ease of programing multi-thread applications in a single-thread way
  • Building pipelines of sessions sharing the same socket channel

Performance and Scalability

  • Support for minimized or even zero unnecessary memory copying
  • Support for low memory utilization in multi-session applications
  • Lower latency
  • zlib and gzip compression
  • Customizable selector loop pooling
  • Customizable byte buffer allocators

Thread model

  • All handler's events (i.e. read, event, timer, exception, incident) are fired from the thread that performs I/O for the channel (I/O thread)
  • All session's methods are thread-safe and can be called from any thread including the I/O thread and non-I/O threads
  • Any handler's event triggered as a side effect of calling a session's method are fired from the I/O thread
  • Codec's code is always processed in the I/O thread
  • Engine's code is always processed in the I/O thread

Supported Protocols

  • HTTP Web Proxy Connect Protocol
  • SOCKS Protocols
  • WebSocket Protocol
  • Toolkit for TLS 1.3 Protocol (parsers/formatters, handshake engine, record layer utils and complete TLS engine)

Security

  • Complete support for SSL/TLS/DTLS protocols
  • Secure Web Proxy Connect

Integration

  • No additional dependencies, JDK 8 or JDK 9 (for DTLS) is enough
  • Fully customizable logging (SLF4J, Log4j 2 already here)
  • Customizable thread factories
  • Customizable session timers
  • Customizable packet retransmission models during DTLS handshakes

Compiling

You need Apache maven 3.8 or above , Java 8 or above

mvn install

Links

snf4j's People

Contributors

wowrona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

snf4j's Issues

unable to connect to example DTLSServer on Java 15

Hello,

I have made a very quick test using the DLTS example classes provided in the project. Unfortunately I for some reason run into problems when I try to connect to a DTLSServer which is started on Java 15? If I switch the server to run on Java 13 it works as expected. I'm using the Liberica JDKs from Bellsoft (https://bell-sw.com/pages/downloads) .

Test 1:
Client (Java 15) -> Server (Java 15) : unsuccessful

Client log info:
[root@tool dtls]# jdk-15.0.2-full/bin/java -cp my.jar -Dorg.snf4j.Host=192.168.0.2 org.snf4j.example.dtls.DTLSClient
[INF] open
[ERR] javax.net.ssl.SSLHandshakeException: The Finished message cannot be verified.
[INF] closed

Test 2:
Client (Java 15) -> Server (Java 13) : SUCCESS - seems to work perfectly!

Find attached a capture file which includes both attempts (Test 1 in frame 1-23, Test 2 start in frame 24):
snf4j-test-java15-java13.zip

openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+10)
OpenJDK 64-Bit Server VM (build 15.0.2+10, mixed mode, sharing)

openjdk version "13.0.2" 2020-01-15
OpenJDK Runtime Environment (build 13.0.2+9)
OpenJDK 64-Bit Server VM (build 13.0.2+9, mixed mode, sharing)

I appreciate all hints about how to resolve this issue.

Thanks, Gunnar

Question about TLS heartbeat extension

Hello,

This is not really an issue, but a general question about which TLS extensions are supported by SNF4J (and Java), in particular the "heartbeat extension" (https://tools.ietf.org/html/rfc6520) .

I assume that the hearbeat extension is not necessarily available in the Java SSLEngine I'm using. Is there anyway I can see which extensions are supported in my environment? Can I somehow control which extensions should be enabled?

In the provided Wireshark trace the client includes the extension "heartbeat", but I don't really understand how I can enable this support also in the server (which is built on SNF4J).
dtls-heartbeat.zip

Any hint is much appreciated! :-)

Thanks, Gunnar

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.