grim/gobnc

Add a .hgignore
draft
2018-08-08, Gary Kramlich
d166328a1bc8
Add a .hgignore
package server
import (
"fmt"
"bitbucket.org/rw_grim/gobnc/irc"
)
// Config handles the configuration data for a server. It may be marshalled to
// yaml.
type Config struct {
ListenAddr string `yaml:"listen-addr"`
Port int `yaml:"port"`
Nick string `yaml:"nick"`
Password string `yaml:"password"`
}
func (c *Config) Valid() error {
if c.ListenAddr == "" {
c.ListenAddr = "127.0.0.1"
}
if c.Port <= 0 || c.Port > 65535 {
return fmt.Errorf("Invalid port %d: must be between 1 and 65535", c.Port)
}
if !irc.NickValid(c.Nick) {
return fmt.Errorf("Invalid nick '%s'", c.Nick)
}
return nil
}