adapters

package
v1.6.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: MIT Imports: 10 Imported by: 0

README

HLA

Hidden Lake Adapters

hla_logo.png

The Hidden Lake Adapters are a way to exchange data between multiple HLS processes via third-party services. Thus, there is no need to use your own computing resources in the face of individual servers to store or distribute the traffic generated by HLS.

More information about HLA in the habr.com/ru/post/720544

How it works

Adapters in their full execution represent one design template - "Flyweight". They are based on the composition of HLS and HLT processes. Adapters adapt to the interfaces of the service for reading/writing data and, thanks to this, are able to conduct anonymizing traffic through the service.

hla_arch.jpg

Figure 1. Architecture of HLA.

Example

Since the adapters are capable of performing the same functions as the source programs, without secret communication channels, then all the examples become similar. So, let's analyze one of the examples based on the echo service.

Build and run nodes

$ cd examples/echo_service/secret_channel
$ make

Send request

$ cd examples/echo_service
$ ./request.sh

Get response

HTTP/1.1 200 OK
Date: Mon, 22 May 2023 18:18:34 GMT
Content-Length: 113
Content-Type: text/plain; charset=utf-8

{"code":200,"head":{"Content-Type":"application/json"},"body":"eyJlY2hvIjoiaGVsbG8sIHdvcmxkISIsInJldHVybiI6MX0K"}
Request took 8 seconds

There are no external differences, but there are internal ones. While the original model assumed the presence of a middle_hls node through which all traffic was broadcast, there is no such intermediate node in the model based on secret communication channels, there is a service that performs its own logical functions that are in no way tied to traffic anonymization. And, thus, adapters use a third-party service in order to pass traffic through it.

hla_request.gif

Figure 2. Example of running HLA client.

Similarly, you can use a more complex composition, as shown in the example examples/anon_messenger/secret_channel.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumeProcessor

func ConsumeProcessor(
	pCtx context.Context,
	pConsumer IAdaptedConsumer,
	pLogger logger.ILogger,
	pHltClient hlt_client.IClient,
	pWaitTimeout time.Duration,
) error

func ProduceProcessor

func ProduceProcessor(
	pCtx context.Context,
	pProducer IAdaptedProducer,
	pLogger logger.ILogger,
	pSettings net_message.ISettings,
	pIncomingAddr string,
) error

Types

type IAdaptedConsumer

type IAdaptedConsumer interface {
	Consume(context.Context) (net_message.IMessage, error)
}

type IAdaptedProducer

type IAdaptedProducer interface {
	Produce(context.Context, net_message.IMessage) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL