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 BanResult
- type ForgiveResult
- type MarketStatus
- type ResumeResult
- type Server
- type SrvConfig
- type SuspendResult
- type SvrCore
- type UnbanResult
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 BanResult ¶
type BanResult struct { AccountID string `json:"accountid"` BrokenRule byte `json:"brokenrule"` BanTime APITime `json:"bantime"` }
BanResult holds the result of a ban.
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 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 { Accounts() (accts []*db.Account, err error) AccountInfo(acctID account.AccountID) (*db.Account, error) Notify(acctID account.AccountID, msg *msgjson.Message) NotifyAll(msg *msgjson.Message) ConfigMsg() json.RawMessage 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) Penalize(aid account.AccountID, rule account.Rule, details string) error Unban(aid account.AccountID) error ForgiveMatchFail(aid account.AccountID, mid order.MatchID) (forgiven, unbanned bool, err error) }
SvrCore is satisfied by server/dex.DEX.
type UnbanResult ¶
type UnbanResult struct { AccountID string `json:"accountid"` UnbanTime APITime `json:"unbantime"` }
UnbanResult holds the result of an unban.