Files
threshold/internal/session/session_connect_with.go
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00

45 lines
1.3 KiB
Go

// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1
package session
import (
"context"
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
)
// ConnectWith defines the boundary data that is saved in the repo when the
// worker has established a connection between the client and the endpoint.
type ConnectWith struct {
ConnectionId string
ClientTcpAddress string
ClientTcpPort uint32
EndpointTcpAddress string
EndpointTcpPort uint32
UserClientIp string
}
func (c ConnectWith) validate(ctx context.Context) error {
const op = "session.(ConnectWith).validate"
if c.ConnectionId == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing session id")
}
if c.ClientTcpAddress == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing client tcp address")
}
if c.ClientTcpPort == 0 {
return errors.New(ctx, errors.InvalidParameter, op, "missing client ctp port")
}
if c.EndpointTcpAddress == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing endpoint tcp address")
}
if c.EndpointTcpPort == 0 {
return errors.New(ctx, errors.InvalidParameter, op, "missing endpoint ctp port")
}
if c.UserClientIp == "" {
return errors.New(ctx, errors.InvalidParameter, op, "missing user client ip")
}
return nil
}