You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/internal/session/connection_closed_with.go

28 lines
648 B

package session
import (
"fmt"
"github.com/hashicorp/boundary/internal/db"
)
// 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 uint64
BytesDown uint64
ClosedReason ClosedReason
}
func (c CloseWith) validate() error {
if c.ConnectionId == "" {
return fmt.Errorf("missing connection id: %w", db.ErrInvalidParameter)
}
if c.ClosedReason.String() == "" {
return fmt.Errorf("missing closed reason: %w", db.ErrInvalidParameter)
}
// 0 is valid for BytesUp and BytesDown
return nil
}