mirror of
https://github.com/ergochat/ergo.git
synced 2026-01-09 20:02:07 -08:00
add PROXY protocol support
This commit is contained in:
parent
a8141a0e1c
commit
4379cb8e1c
2 changed files with 39 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ var (
|
|||
"PING": NewPingCommand,
|
||||
"PONG": NewPongCommand,
|
||||
"PRIVMSG": NewPrivMsgCommand,
|
||||
"PROXY": NewProxyCommand,
|
||||
"QUIT": NewQuitCommand,
|
||||
"TOPIC": NewTopicCommand,
|
||||
"USER": NewUserMsgCommand,
|
||||
|
|
@ -581,3 +582,30 @@ func NewCapCommand(args []string) (editableCommand, error) {
|
|||
args: args,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// HAPROXY support
|
||||
type ProxyCommand struct {
|
||||
BaseCommand
|
||||
net string
|
||||
sourceIP string
|
||||
destIP string
|
||||
sourcePort string
|
||||
destPort string
|
||||
}
|
||||
|
||||
func (msg *ProxyCommand) String() string {
|
||||
return fmt.Sprintf("PROXY(sourceIP=%s, sourcePort=%s)", msg.sourceIP, msg.sourcePort)
|
||||
}
|
||||
|
||||
func NewProxyCommand(args []string) (editableCommand, error) {
|
||||
if len(args) < 5 {
|
||||
return nil, NotEnoughArgsError
|
||||
}
|
||||
return &ProxyCommand{
|
||||
net: args[0],
|
||||
sourceIP: args[1],
|
||||
destIP: args[2],
|
||||
sourcePort: args[3],
|
||||
destPort: args[4],
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue