Giter Site home page Giter Site logo

Handshake phase support about influent HOT 10 OPEN

okumin avatar okumin commented on August 27, 2024
Handshake phase support

from influent.

Comments (10)

okkez avatar okkez commented on August 27, 2024

I'm implementing handshake phase support https://github.com/okkez/influent/tree/support-fluentd-handshake
But it is work in progress.
Do you like this?
Feel free to comment, please.

from influent.

okumin avatar okumin commented on August 27, 2024

I think that NioForwardConnection with handshake support is a finite state machine, so it looks nice that
onReadable branches into switch (state).
So your plan is good.

In detail,

  • HELO is the first message of the protocol and it is sent by a server. So it should be fired in constructor
    • onReadable is invoked when the server is received some packets, but the client never send messages until HELO is received
    • Stores the HELO message in responses(the variable name became bad……) and invoke eventLoop.enableInterestSet(key, SelectionKey.OP_WRITE)
  • Messages for handshake may be arrived partially, so it should be parsed incrementally

from influent.

okumin avatar okumin commented on August 27, 2024

influent-architecture

from influent.

okumin avatar okumin commented on August 27, 2024

There are three conversions.

  • Fluentd domain object <-> An array of Msgpack
    • One message of Fluentd matches one array of msgpack
  • An array of Msgpack <-> ByteBuffer
    • Encoding is easy since an array of msgpack has full information needed for binary representation from the beginning
    • Decoding is a bit difficult since TCP stack may send one array of msgpack as multiple packets
  • java.util.ByteBuffer <-> socket buffer
    • Write/Read ByteBuffers to/from TCP stack
    • Influent is implemented by non-blocking API of NIO

Array of Msgpack <-> ByteBuffer is already provided by MessageBufferPacker and MsgpackStreamUnpacker.
So we can support handshake phase by implementing handshake logic and Fluentd domain object <-> An array of Msgpack conversion.

from influent.

okkez avatar okkez commented on August 27, 2024

We need IP address checking like following:

But Java standard libraries don't have such utilities as far as I know.
Do you have any idea for remote address checking?

from influent.

okumin avatar okumin commented on August 27, 2024

I feel that it is simple to implement such a logic.
But it is also OK to use third party library if it is light(not such Netty).

from influent.

okkez avatar okkez commented on August 27, 2024

Thank you for comments!
I could not find out tiny library. So I've implemented InetNetwork class with reference to Apache James.

from influent.

okumin avatar okumin commented on August 27, 2024

I found Apache Commons Net.

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/util/SubnetUtils.html

How about SubnetInfo#isInRange ?

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/util/SubnetUtils.SubnetInfo.html#isInRange(java.lang.String)

from influent.

okkez avatar okkez commented on August 27, 2024

I think commons-net is large, it is 300KB.
https://mvnrepository.com/artifact/commons-net/commons-net/3.6

commons-net does not support IPv6, but I've implemented both IPv4 and IPv6.

from influent.

okkez avatar okkez commented on August 27, 2024

Created #32

from influent.

Related Issues (8)

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.