mirror of
https://github.com/jeremyd/ergo.git
synced 2026-06-21 19:51:03 -07:00
PROXY: Remove command, I don't think it's that useful
This commit is contained in:
+1
-2
@@ -126,8 +126,7 @@ func (client *Client) run() {
|
||||
var line string
|
||||
var msg ircmsg.IrcMessage
|
||||
|
||||
// Set the hostname for this client. The client may later send a PROXY
|
||||
// command from stunnel that sets the hostname to something more accurate.
|
||||
// Set the hostname for this client
|
||||
client.hostname = AddrLookupHostname(client.socket.conn.RemoteAddr())
|
||||
|
||||
//TODO(dan): Make this a socketreactor from ircbnc
|
||||
|
||||
@@ -146,11 +146,6 @@ var Commands = map[string]Command{
|
||||
handler: privmsgHandler,
|
||||
minParams: 2,
|
||||
},
|
||||
"PROXY": {
|
||||
handler: proxyHandler,
|
||||
usablePreReg: true,
|
||||
minParams: 5,
|
||||
},
|
||||
"SANICK": {
|
||||
handler: sanickHandler,
|
||||
minParams: 2,
|
||||
|
||||
+8
-9
@@ -72,15 +72,14 @@ type Config struct {
|
||||
|
||||
Server struct {
|
||||
PassConfig
|
||||
Password string
|
||||
Name string
|
||||
Listen []string
|
||||
Wslisten string `yaml:"ws-listen"`
|
||||
TLSListeners map[string]*TLSListenConfig `yaml:"tls-listeners"`
|
||||
CheckIdent bool `yaml:"check-ident"`
|
||||
Log string
|
||||
MOTD string
|
||||
ProxyAllowedFrom []string `yaml:"proxy-allowed-from"`
|
||||
Password string
|
||||
Name string
|
||||
Listen []string
|
||||
Wslisten string `yaml:"ws-listen"`
|
||||
TLSListeners map[string]*TLSListenConfig `yaml:"tls-listeners"`
|
||||
CheckIdent bool `yaml:"check-ident"`
|
||||
Log string
|
||||
MOTD string
|
||||
}
|
||||
|
||||
Datastore struct {
|
||||
|
||||
@@ -187,13 +187,6 @@ Replies to a PING. Used to check link connectivity.`,
|
||||
text: `PRIVMSG <target>{,<target>} <text to be sent>
|
||||
|
||||
Sends the text to the given targets as a PRIVMSG.`,
|
||||
},
|
||||
"proxy": {
|
||||
oper: true, // not really, but it's restricted anyways
|
||||
text: `PROXY TCP4/6 <sourceip> <destip> <sourceport> <destport>
|
||||
|
||||
Used by haproxy's PROXY protocol, to allow for alternate TLS support:
|
||||
http://www.haproxy.org/download/1.7/doc/proxy-protocol.txt`,
|
||||
},
|
||||
"sanick": {
|
||||
oper: true,
|
||||
|
||||
@@ -51,7 +51,6 @@ type Server struct {
|
||||
passwords *PasswordManager
|
||||
accountRegistration *AccountRegistration
|
||||
signals chan os.Signal
|
||||
proxyAllowedFrom []string
|
||||
whoWas *WhoWasList
|
||||
isupport *ISupportList
|
||||
checkIdent bool
|
||||
@@ -97,7 +96,6 @@ func NewServer(config *Config) *Server {
|
||||
newConns: make(chan clientConn),
|
||||
operators: config.Operators(),
|
||||
signals: make(chan os.Signal, len(SERVER_SIGNALS)),
|
||||
proxyAllowedFrom: config.Server.ProxyAllowedFrom,
|
||||
whoWas: NewWhoWasList(config.Limits.WhowasEntries),
|
||||
checkIdent: config.Server.CheckIdent,
|
||||
}
|
||||
@@ -416,23 +414,6 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// PROXY TCP4/6 SOURCEIP DESTIP SOURCEPORT DESTPORT
|
||||
// http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
|
||||
func proxyHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
clientAddress := IPString(client.socket.conn.RemoteAddr())
|
||||
clientHostname := client.hostname
|
||||
|
||||
for _, address := range server.proxyAllowedFrom {
|
||||
if clientHostname == address || clientAddress == address {
|
||||
client.hostname = LookupHostname(msg.Params[1])
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
client.Quit("PROXY command is not usable from your address")
|
||||
return true
|
||||
}
|
||||
|
||||
// USER <username> * 0 <realname>
|
||||
func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
||||
if client.registered {
|
||||
|
||||
Reference in New Issue
Block a user