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>
32 lines
815 B
Go
32 lines
815 B
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package session
|
|
|
|
import (
|
|
"context"
|
|
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/errors"
|
|
)
|
|
|
|
// CloseWith defines the boundary data that is saved in the repo when the
|
|
// worker closes a connection between the client and the endpoint.
|
|
type CloseWith struct {
|
|
ConnectionId string
|
|
BytesUp int64
|
|
BytesDown int64
|
|
ClosedReason ClosedReason
|
|
}
|
|
|
|
func (c CloseWith) validate(ctx context.Context) error {
|
|
const op = "session.(CloseWith).validate"
|
|
if c.ConnectionId == "" {
|
|
return errors.New(ctx, errors.InvalidParameter, op, "missing connection id")
|
|
}
|
|
if c.ClosedReason.String() == "" {
|
|
return errors.New(ctx, errors.InvalidParameter, op, "missing closed reason")
|
|
}
|
|
// 0 is valid for BytesUp and BytesDown
|
|
return nil
|
|
}
|