Class TLSBabelChannel
java.lang.Object
pt.unl.fct.di.novasys.babel2.channels.tcp_tls.AbstractTCPBabelChannel
pt.unl.fct.di.novasys.babel2.channels.tcp_tls.TLSBabelChannel
- All Implemented Interfaces:
BabelChannel, IPBabelChannel
Concrete TLS-over-TCP Babel channel implementation that transports messages
over
persistent TCP connections secured with mutual TLS.
Configures Netty's ServerSocketChannel and client Bootstrap
pipelines with
TLS encryption, length-field framing, and handshake codecs.
Instances of this channel should be created via builder().
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractTCPBabelChannel
AbstractTCPBabelChannel.TCPBabelChannelAuthModeModifier and TypeClassDescriptionstatic enumModes used to describe which types of signed messages are allowed on the channel. -
Field Summary
Fields inherited from class AbstractTCPBabelChannel
DEFAULT_CONNECTION_UP_DELAY, DEFAULT_CONNECTION_UP_DELAY_UNIT, EXPECTED_PEER, HANDSHAKE_CODEC_NAME, HANDSHAKE_HANDLER_NAMEModifier and TypeFieldDescriptionstatic final longDefault delay before delivering a connection up event to allow state settling.static final TimeUnitDefault time unit forAbstractTCPBabelChannel.DEFAULT_CONNECTION_UP_DELAY.static final io.netty.util.AttributeKey<BabelNode> Netty channel attribute key storing the expected remote peer node identity for outbound connections.static final StringName of the handshake codec handler in the Netty pipeline.static final StringName of the handshake handler in the Netty pipeline. -
Method Summary
Modifier and TypeMethodDescriptionstatic TLSBabelChannelBuilderbuilder()Creates a newTLSBabelChannelBuilderinstance for configuring aTLSBabelChannel.protected io.netty.bootstrap.BootstrapcreateClientBootstrap(Babel runtime, NodeStore store, io.netty.channel.EventLoopGroup workerGroup, int numberOfMessages, boolean verifyIdentity, AbstractTCPBabelChannel.TCPBabelChannelAuthMode authMode, @Nullable Set<BabelNode> permittedNodes) Creates and configures the Netty clientBootstrapfor initiating outbound connections.protected io.netty.channel.socket.ServerSocketChannelcreateServerSocketChannel(Babel runtime, NodeStore store, InetSocketAddress address, io.netty.channel.EventLoopGroup workerGroup, int numberOfMessages, boolean verifyIdentity, AbstractTCPBabelChannel.TCPBabelChannelAuthMode authMode, @Nullable Set<BabelNode> permittedNodes) Creates and binds the NettyServerSocketChannelfor accepting incoming connections.Methods inherited from class AbstractTCPBabelChannel
connect, disconnect, getBindingAddress, getPermittedNodes, init, isConnected, send, sendEphemeral, shutdownModifier and TypeMethodDescriptionvoidInitiates a TCP connection to the specified peer node.voiddisconnect(BabelNode peer) Disconnects the active TCP connection to the specified peer.Returns the local socket address to which the server socket channel is bound.Returns the set of permitted nodes for this channel, ornullif all nodes are permitted.protected voidinit(InetSocketAddress address, io.netty.channel.EventLoopGroup workerGroup, int numberOfMessages, boolean verifyIdentity, AbstractTCPBabelChannel.TCPBabelChannelAuthMode authMode) Initializes the server channel and client bootstrap by invoking the subclass-defined channel and bootstrap factory methods using the configured permitted nodes.booleanisConnected(BabelNode peer) Checks whether an active TCP connection to the specified peer exists.voidsend(BabelNode peer, BabelMessage message) Sends aBabelMessageto the specified peer over the active TCP connection.voidsendEphemeral(BabelNode peer, BabelMessage message) Sends a message topeerwithout establishing a persistent connection.voidshutdown()Shuts down the TCP server channel and terminates all active peer connections.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BabelChannel
getInnerModifier and TypeMethodDescriptiondefault BabelChannelgetInner()Gets this channel or returns the inner channel if this instance is a wrapper.
-
Method Details
-
createServerSocketChannel
protected io.netty.channel.socket.ServerSocketChannel createServerSocketChannel(Babel runtime, NodeStore store, InetSocketAddress address, io.netty.channel.EventLoopGroup workerGroup, int numberOfMessages, boolean verifyIdentity, AbstractTCPBabelChannel.TCPBabelChannelAuthMode authMode, @Nullable Set<BabelNode> permittedNodes) Description copied from class:AbstractTCPBabelChannelCreates and binds the NettyServerSocketChannelfor accepting incoming connections.- Specified by:
createServerSocketChannelin classAbstractTCPBabelChannel- Parameters:
runtime- the Babel runtimestore- the node store for address and component resolutionaddress- the local address to bind toworkerGroup- the Netty event loop group for channel I/OnumberOfMessages- outbound message queue buffer capacity per connectionverifyIdentity- whether cryptographic identity verification is enabledauthMode- the authentication mode configuring accepted message typespermittedNodes- the set of permitted nodes, ornullif all nodes are permitted- Returns:
- the bound and initialized
ServerSocketChannel
-
createClientBootstrap
protected io.netty.bootstrap.Bootstrap createClientBootstrap(Babel runtime, NodeStore store, io.netty.channel.EventLoopGroup workerGroup, int numberOfMessages, boolean verifyIdentity, AbstractTCPBabelChannel.TCPBabelChannelAuthMode authMode, @Nullable Set<BabelNode> permittedNodes) Description copied from class:AbstractTCPBabelChannelCreates and configures the Netty clientBootstrapfor initiating outbound connections.- Specified by:
createClientBootstrapin classAbstractTCPBabelChannel- Parameters:
runtime- the Babel runtimestore- the node store for address and component resolutionworkerGroup- the Netty event loop group for channel I/OnumberOfMessages- outbound message queue buffer capacity per connectionverifyIdentity- whether cryptographic identity verification is enabledauthMode- the authentication mode configuring accepted message typespermittedNodes- the set of permitted nodes, ornullif all nodes are permitted- Returns:
- the configured client
Bootstrap
-
builder
Creates a newTLSBabelChannelBuilderinstance for configuring aTLSBabelChannel.- Returns:
- a new channel builder
-