Integrate BACKBEAT SDK and resolve KACHING license validation

Major integrations and fixes:
- Added BACKBEAT SDK integration for P2P operation timing
- Implemented beat-aware status tracking for distributed operations
- Added Docker secrets support for secure license management
- Resolved KACHING license validation via HTTPS/TLS
- Updated docker-compose configuration for clean stack deployment
- Disabled rollback policies to prevent deployment failures
- Added license credential storage (CHORUS-DEV-MULTI-001)

Technical improvements:
- BACKBEAT P2P operation tracking with phase management
- Enhanced configuration system with file-based secrets
- Improved error handling for license validation
- Clean separation of KACHING and CHORUS deployment stacks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-09-06 07:56:26 +10:00
parent 543ab216f9
commit 9bdcbe0447
4730 changed files with 1480093 additions and 1916 deletions

View File

@@ -0,0 +1,49 @@
package yamux
import (
"context"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-yamux/v4"
)
// conn implements mux.MuxedConn over yamux.Session.
type conn yamux.Session
var _ network.MuxedConn = &conn{}
// NewMuxedConn constructs a new MuxedConn from a yamux.Session.
func NewMuxedConn(m *yamux.Session) network.MuxedConn {
return (*conn)(m)
}
// Close closes underlying yamux
func (c *conn) Close() error {
return c.yamux().Close()
}
// IsClosed checks if yamux.Session is in closed state.
func (c *conn) IsClosed() bool {
return c.yamux().IsClosed()
}
// OpenStream creates a new stream.
func (c *conn) OpenStream(ctx context.Context) (network.MuxedStream, error) {
s, err := c.yamux().OpenStream(ctx)
if err != nil {
return nil, err
}
return (*stream)(s), nil
}
// AcceptStream accepts a stream opened by the other side.
func (c *conn) AcceptStream() (network.MuxedStream, error) {
s, err := c.yamux().AcceptStream()
return (*stream)(s), err
}
func (c *conn) yamux() *yamux.Session {
return (*yamux.Session)(c)
}

View File

@@ -0,0 +1,64 @@
package yamux
import (
"time"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-yamux/v4"
)
// stream implements mux.MuxedStream over yamux.Stream.
type stream yamux.Stream
var _ network.MuxedStream = &stream{}
func (s *stream) Read(b []byte) (n int, err error) {
n, err = s.yamux().Read(b)
if err == yamux.ErrStreamReset {
err = network.ErrReset
}
return n, err
}
func (s *stream) Write(b []byte) (n int, err error) {
n, err = s.yamux().Write(b)
if err == yamux.ErrStreamReset {
err = network.ErrReset
}
return n, err
}
func (s *stream) Close() error {
return s.yamux().Close()
}
func (s *stream) Reset() error {
return s.yamux().Reset()
}
func (s *stream) CloseRead() error {
return s.yamux().CloseRead()
}
func (s *stream) CloseWrite() error {
return s.yamux().CloseWrite()
}
func (s *stream) SetDeadline(t time.Time) error {
return s.yamux().SetDeadline(t)
}
func (s *stream) SetReadDeadline(t time.Time) error {
return s.yamux().SetReadDeadline(t)
}
func (s *stream) SetWriteDeadline(t time.Time) error {
return s.yamux().SetWriteDeadline(t)
}
func (s *stream) yamux() *yamux.Stream {
return (*yamux.Stream)(s)
}

View File

@@ -0,0 +1,63 @@
package yamux
import (
"io"
"math"
"net"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-yamux/v4"
)
var DefaultTransport *Transport
const ID = "/yamux/1.0.0"
func init() {
config := yamux.DefaultConfig()
// We've bumped this to 16MiB as this critically limits throughput.
//
// 1MiB means a best case of 10MiB/s (83.89Mbps) on a connection with
// 100ms latency. The default gave us 2.4MiB *best case* which was
// totally unacceptable.
config.MaxStreamWindowSize = uint32(16 * 1024 * 1024)
// don't spam
config.LogOutput = io.Discard
// We always run over a security transport that buffers internally
// (i.e., uses a block cipher).
config.ReadBufSize = 0
// Effectively disable the incoming streams limit.
// This is now dynamically limited by the resource manager.
config.MaxIncomingStreams = math.MaxUint32
DefaultTransport = (*Transport)(config)
}
// Transport implements mux.Multiplexer that constructs
// yamux-backed muxed connections.
type Transport yamux.Config
var _ network.Multiplexer = &Transport{}
func (t *Transport) NewConn(nc net.Conn, isServer bool, scope network.PeerScope) (network.MuxedConn, error) {
var newSpan func() (yamux.MemoryManager, error)
if scope != nil {
newSpan = func() (yamux.MemoryManager, error) { return scope.BeginSpan() }
}
var s *yamux.Session
var err error
if isServer {
s, err = yamux.Server(nc, t.Config(), newSpan)
} else {
s, err = yamux.Client(nc, t.Config(), newSpan)
}
if err != nil {
return nil, err
}
return NewMuxedConn(s), nil
}
func (t *Transport) Config() *yamux.Config {
return (*yamux.Config)(t)
}