mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Add ban and unban RPC commands * Fix names * Fix commands strings * Update RPC documentation * Rename functions * Simplify return * Use IP strings in app messages * Add parse IP error * Fix wrong condition
40 lines
927 B
Go
40 lines
927 B
Go
package appmessage
|
|
|
|
// BanRequestMessage is an appmessage corresponding to
|
|
// its respective RPC message
|
|
type BanRequestMessage struct {
|
|
baseMessage
|
|
|
|
IP string
|
|
}
|
|
|
|
// Command returns the protocol command string for the message
|
|
func (msg *BanRequestMessage) Command() MessageCommand {
|
|
return CmdBanRequestMessage
|
|
}
|
|
|
|
// NewBanRequestMessage returns an instance of the message
|
|
func NewBanRequestMessage(ip string) *BanRequestMessage {
|
|
return &BanRequestMessage{
|
|
IP: ip,
|
|
}
|
|
}
|
|
|
|
// BanResponseMessage is an appmessage corresponding to
|
|
// its respective RPC message
|
|
type BanResponseMessage struct {
|
|
baseMessage
|
|
|
|
Error *RPCError
|
|
}
|
|
|
|
// Command returns the protocol command string for the message
|
|
func (msg *BanResponseMessage) Command() MessageCommand {
|
|
return CmdBanResponseMessage
|
|
}
|
|
|
|
// NewBanResponseMessage returns a instance of the message
|
|
func NewBanResponseMessage() *BanResponseMessage {
|
|
return &BanResponseMessage{}
|
|
}
|