Documentation ¶
Overview ¶
Package admin provides a password protected https server to send commands to a running dex server.
Index ¶
- Constants
- func PasswordHashPrompt(ctx context.Context, prompt string) ([sha256.Size]byte, error)
- func PasswordPrompt(ctx context.Context, prompt string) ([]byte, error)
- func UseLogger(logger slog.Logger)
- type APITime
- type AssetInfo
- type AssetPost
- type ForgiveResult
- type MarketStatus
- type MatchData
- type ResumeResult
- type Server
- type SrvConfig
- type SuspendResult
- type SvrCore
Constants ¶
const RFC3339Milli = "2006-01-02T15:04:05.999Z07:00"
RFC3339Milli is the RFC3339 time formatting with millisecond precision.
Variables ¶
This section is empty.
Functions ¶
func PasswordHashPrompt ¶
PasswordHashPrompt prompts the user to enter a password and returns its SHA256 hash. Password must not be an empty string.
func PasswordPrompt ¶
PasswordPrompt prompts the user to enter a password. Password must not be an empty string.
Types ¶
type APITime ¶
APITime marshals and unmarshals a time value in time.RFC3339Nano format.
func (*APITime) MarshalJSON ¶
MarshalJSON marshals APITime to a JSON string in RFC3339 format except with millisecond precision.
func (*APITime) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON string containing a time in RFC3339 format with millisecond precision into an APITime.
type AssetInfo ¶
type AssetInfo struct { dex.Asset CurrentFeeRate uint64 `json:"currentFeeRate,omitempty"` ScaledFeeRate uint64 `json:"scaledFeeRate,omitempty"` Synced bool `json:"synced"` Errors []string `json:"errors,omitempty"` }
AssetInfo is the result of the asset GET. Note that ScaledFeeRate is CurrentFeeRate multiplied by an operator-specified fee scale rate for this asset, and then limited by the dex.Asset.MaxFeeRate.
type AssetPost ¶
type AssetPost struct {
FeeRateScale *float64 `json:"feeRateScale,omitempty"`
}
AssetPost is the expected structure of the asset POST data.
type ForgiveResult ¶
type ForgiveResult struct { AccountID string `json:"accountid"` Forgiven bool `json:"forgiven"` Unbanned bool `json:"unbanned"` ForgiveTime APITime `json:"forgivetime"` }
ForgiveResult holds the result of a forgive_match.
type MarketStatus ¶
type MarketStatus struct { Name string `json:"market,omitempty"` Running bool `json:"running"` EpochDuration uint64 `json:"epochlen"` ActiveEpoch int64 `json:"activeepoch"` StartEpoch int64 `json:"startepoch"` SuspendEpoch int64 `json:"finalepoch,omitempty"` PersistBook *bool `json:"persistbook,omitempty"` }
MarketStatus summarizes the operational status of a market.
type MatchData ¶ added in v0.2.0
type MatchData struct { ID string `json:"id"` TakerSell bool `json:"takerSell"` Maker string `json:"makerOrder"` MakerAcct string `json:"makerAcct"` MakerSwap string `json:"makerSwap"` MakerRedeem string `json:"makerRedeem"` MakerAddr string `json:"makerAddr"` Taker string `json:"takerOrder"` TakerAcct string `json:"takerAcct"` TakerSwap string `json:"takerSwap"` TakerRedeem string `json:"takerRedeem"` TakerAddr string `json:"takerAddr"` EpochIdx uint64 `json:"epochIdx"` EpochDur uint64 `json:"epochDur"` Quantity uint64 `json:"quantity"` Rate uint64 `json:"rate"` BaseRate uint64 `json:"baseFeeRate"` QuoteRate uint64 `json:"quoteFeeRate"` Active bool `json:"active"` Status string `json:"status"` }
MatchData describes a match.
type ResumeResult ¶
type ResumeResult struct { Market string `json:"market"` StartEpoch int64 `json:"startepoch"` StartTime APITime `json:"starttime"` }
ResumeResult is the result of a market resume request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a multi-client https server.
type SuspendResult ¶
type SuspendResult struct { Market string `json:"market"` FinalEpoch int64 `json:"finalepoch"` SuspendTime APITime `json:"supendtime"` }
SuspendResult describes the result of a market suspend request. FinalEpoch is the last epoch before shutdown, and it the market will run for it's entire duration. As such, SuspendTime is the time at which the market is closed, immediately after close of FinalEpoch.
type SvrCore ¶
type SvrCore interface { AccountInfo(acctID account.AccountID) (*db.Account, error) UserMatchFails(aid account.AccountID, n int) ([]*auth.MatchFail, error) Notify(acctID account.AccountID, msg *msgjson.Message) NotifyAll(msg *msgjson.Message) ConfigMsg() json.RawMessage Asset(id uint32) (*asset.BackedAsset, error) SetFeeRateScale(assetID uint32, scale float64) ScaleFeeRate(assetID uint32, rate uint64) uint64 MarketRunning(mktName string) (found, running bool) MarketStatus(mktName string) *market.Status MarketStatuses() map[string]*market.Status SuspendMarket(name string, tSusp time.Time, persistBooks bool) (*market.SuspendEpoch, error) ResumeMarket(name string, asSoonAs time.Time) (startEpoch int64, startTime time.Time, err error) ForgiveMatchFail(aid account.AccountID, mid order.MatchID) (forgiven, unbanned bool, err error) AccountMatchOutcomesN(user account.AccountID, n int) ([]*auth.MatchOutcome, error) BookOrders(base, quote uint32) (orders []*order.LimitOrder, err error) EpochOrders(base, quote uint32) (orders []order.Order, err error) MarketMatchesStreaming(base, quote uint32, includeInactive bool, N int64, f func(*dexsrv.MatchData) error) (int, error) EnableDataAPI(yes bool) CreatePrepaidBonds(n int, strength uint32, durSecs int64) ([][]byte, error) }
SvrCore is satisfied by server/dex.DEX.