parent
832d8b89a2
commit
07c962018d
@ -97,8 +97,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
srv := soju.NewServer(db)
|
srv := soju.NewServer(db)
|
||||||
// TODO: load from config/DB
|
|
||||||
srv.Hostname = cfg.Hostname
|
srv.Hostname = cfg.Hostname
|
||||||
|
srv.Title = cfg.Title
|
||||||
srv.LogPath = cfg.LogPath
|
srv.LogPath = cfg.LogPath
|
||||||
srv.HTTPOrigins = cfg.HTTPOrigins
|
srv.HTTPOrigins = cfg.HTTPOrigins
|
||||||
srv.AcceptProxyIPs = cfg.AcceptProxyIPs
|
srv.AcceptProxyIPs = cfg.AcceptProxyIPs
|
||||||
|
@ -38,8 +38,9 @@ type TLS struct {
|
|||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
Listen []string
|
Listen []string
|
||||||
Hostname string
|
|
||||||
TLS *TLS
|
TLS *TLS
|
||||||
|
Hostname string
|
||||||
|
Title string
|
||||||
MOTDPath string
|
MOTDPath string
|
||||||
|
|
||||||
SQLDriver string
|
SQLDriver string
|
||||||
@ -87,6 +88,14 @@ func parse(cfg scfg.Block) (*Server, error) {
|
|||||||
if err := d.ParseParams(&srv.Hostname); err != nil {
|
if err := d.ParseParams(&srv.Hostname); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
case "title":
|
||||||
|
if err := d.ParseParams(&srv.Title); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
case "motd":
|
||||||
|
if err := d.ParseParams(&srv.MOTDPath); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
case "tls":
|
case "tls":
|
||||||
tls := &TLS{}
|
tls := &TLS{}
|
||||||
if err := d.ParseParams(&tls.CertPath, &tls.KeyPath); err != nil {
|
if err := d.ParseParams(&tls.CertPath, &tls.KeyPath); err != nil {
|
||||||
@ -129,10 +138,6 @@ func parse(cfg scfg.Block) (*Server, error) {
|
|||||||
if srv.MaxUserNetworks, err = strconv.Atoi(max); err != nil {
|
if srv.MaxUserNetworks, err = strconv.Atoi(max); err != nil {
|
||||||
return nil, fmt.Errorf("directive %q: %v", d.Name, err)
|
return nil, fmt.Errorf("directive %q: %v", d.Name, err)
|
||||||
}
|
}
|
||||||
case "motd":
|
|
||||||
if err := d.ParseParams(&srv.MOTDPath); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown directive %q", d.Name)
|
return nil, fmt.Errorf("unknown directive %q", d.Name)
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,10 @@ The following directives are supported:
|
|||||||
*hostname* <name>
|
*hostname* <name>
|
||||||
Server hostname (default: system hostname).
|
Server hostname (default: system hostname).
|
||||||
|
|
||||||
|
*title* <title>
|
||||||
|
Server title. This will be sent as the _ISUPPORT NETWORK_ value when clients
|
||||||
|
don't select a specific network.
|
||||||
|
|
||||||
*tls* <cert> <key>
|
*tls* <cert> <key>
|
||||||
Enable TLS support. The certificate and the key files must be PEM-encoded.
|
Enable TLS support. The certificate and the key files must be PEM-encoded.
|
||||||
|
|
||||||
|
@ -1157,7 +1157,9 @@ func (dc *downstreamConn) welcome() error {
|
|||||||
if dc.network != nil {
|
if dc.network != nil {
|
||||||
isupport = append(isupport, fmt.Sprintf("BOUNCER_NETID=%v", dc.network.ID))
|
isupport = append(isupport, fmt.Sprintf("BOUNCER_NETID=%v", dc.network.ID))
|
||||||
}
|
}
|
||||||
|
if dc.network == nil && dc.srv.Title != "" {
|
||||||
|
isupport = append(isupport, "NETWORK="+encodeISUPPORT(dc.srv.Title))
|
||||||
|
}
|
||||||
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
if dc.network == nil && dc.caps["soju.im/bouncer-networks"] {
|
||||||
isupport = append(isupport, "WHOX")
|
isupport = append(isupport, "WHOX")
|
||||||
}
|
}
|
||||||
|
6
irc.go
6
irc.go
@ -761,3 +761,9 @@ func generateWHOXReply(prefix *irc.Prefix, nick, fields string, info *whoxInfo)
|
|||||||
Params: append([]string{nick}, params...),
|
Params: append([]string{nick}, params...),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isupportEncoder = strings.NewReplacer(" ", "\\x20", "\\", "\\x5C")
|
||||||
|
|
||||||
|
func encodeISUPPORT(s string) string {
|
||||||
|
return isupportEncoder.Replace(s)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user