2024-09-09 14:34:00 +00:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
|
|
|
"isle/daemon/daecommon"
|
|
|
|
"isle/daemon/jsonrpc2"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
errCodeInitializing = daecommon.ErrorCodeRangeNetwork + iota
|
|
|
|
errCodeInvalidConfig
|
|
|
|
errCodeHostNotFound
|
2024-12-12 19:20:27 +00:00
|
|
|
errCodeIPInUse
|
2024-12-15 20:39:41 +00:00
|
|
|
errCodeSecretNotFound
|
2024-09-09 14:34:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrInitializing is returned when a network is unavailable due to still
|
|
|
|
// being initialized.
|
|
|
|
ErrInitializing = jsonrpc2.NewError(errCodeInitializing, "Network is being initialized")
|
|
|
|
|
|
|
|
// ErrInvalidConfig is returned when the daemon's configuration is invalid
|
|
|
|
// for an operation being attempted.
|
|
|
|
//
|
|
|
|
// The Data field will be a string containing further details.
|
|
|
|
ErrInvalidConfig = jsonrpc2.NewError(errCodeInvalidConfig, "Invalid daemon config")
|
|
|
|
|
|
|
|
// ErrHostNotFound is returned when performing an operation which expected a
|
|
|
|
// host to exist in the network, but that host wasn't found.
|
|
|
|
ErrHostNotFound = jsonrpc2.NewError(errCodeHostNotFound, "Host not found")
|
2024-12-12 19:20:27 +00:00
|
|
|
|
|
|
|
// ErrIPInUse is returned when performing an operation which was provided an
|
|
|
|
// IP already in use by another host in the network.
|
|
|
|
ErrIPInUse = jsonrpc2.NewError(errCodeIPInUse, "IP in use")
|
2024-12-15 20:39:41 +00:00
|
|
|
|
|
|
|
// ErrSecretNotFound is returned when a secret was required to perform some
|
|
|
|
// action, but the secret is not found in the secret store.
|
|
|
|
ErrSecretNotFound = jsonrpc2.NewError(errCodeSecretNotFound, "Secret not found")
|
2024-09-09 14:34:00 +00:00
|
|
|
)
|