You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.go 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  1. // Copyright (c) 2012-2014 Jeremy Latt
  2. // Copyright (c) 2014-2015 Edmund Huber
  3. // Copyright (c) 2016-2017 Daniel Oaks <daniel@danieloaks.net>
  4. // released under the MIT license
  5. package irc
  6. import (
  7. "bufio"
  8. "crypto/tls"
  9. "encoding/base64"
  10. "fmt"
  11. "log"
  12. "math/rand"
  13. "net"
  14. "os"
  15. "os/signal"
  16. "strconv"
  17. "strings"
  18. "sync"
  19. "syscall"
  20. "time"
  21. "github.com/goshuirc/irc-go/ircfmt"
  22. "github.com/goshuirc/irc-go/ircmsg"
  23. "github.com/oragono/oragono/irc/caps"
  24. "github.com/oragono/oragono/irc/connection_limits"
  25. "github.com/oragono/oragono/irc/isupport"
  26. "github.com/oragono/oragono/irc/languages"
  27. "github.com/oragono/oragono/irc/logger"
  28. "github.com/oragono/oragono/irc/modes"
  29. "github.com/oragono/oragono/irc/passwd"
  30. "github.com/oragono/oragono/irc/sno"
  31. "github.com/oragono/oragono/irc/utils"
  32. "github.com/tidwall/buntdb"
  33. )
  34. var (
  35. // common error line to sub values into
  36. errorMsg, _ = (&[]ircmsg.IrcMessage{ircmsg.MakeMessage(nil, "", "ERROR", "%s ")}[0]).Line()
  37. // common error responses
  38. couldNotParseIPMsg, _ = (&[]ircmsg.IrcMessage{ircmsg.MakeMessage(nil, "", "ERROR", "Unable to parse your IP address")}[0]).Line()
  39. // supportedUserModesString acts as a cache for when we introduce users
  40. supportedUserModesString = modes.SupportedUserModes.String()
  41. // supportedChannelModesString acts as a cache for when we introduce users
  42. supportedChannelModesString = modes.SupportedChannelModes.String()
  43. // SupportedCapabilities are the caps we advertise.
  44. // MaxLine, SASL and STS are set during server startup.
  45. SupportedCapabilities = caps.NewSet(caps.AccountTag, caps.AccountNotify, caps.AwayNotify, caps.Batch, caps.CapNotify, caps.ChgHost, caps.EchoMessage, caps.ExtendedJoin, caps.InviteNotify, caps.LabeledResponse, caps.Languages, caps.MessageTags, caps.MultiPrefix, caps.Rename, caps.Resume, caps.ServerTime, caps.UserhostInNames)
  46. // CapValues are the actual values we advertise to v3.2 clients.
  47. // actual values are set during server startup.
  48. CapValues = caps.NewValues()
  49. )
  50. // Limits holds the maximum limits for various things such as topic lengths.
  51. type Limits struct {
  52. AwayLen int
  53. ChannelLen int
  54. KickLen int
  55. MonitorEntries int
  56. NickLen int
  57. TopicLen int
  58. ChanListModes int
  59. LineLen LineLenLimits
  60. }
  61. // LineLenLimits holds the maximum limits for IRC lines.
  62. type LineLenLimits struct {
  63. Tags int
  64. Rest int
  65. }
  66. // ListenerWrapper wraps a listener so it can be safely reconfigured or stopped
  67. type ListenerWrapper struct {
  68. listener net.Listener
  69. tlsConfig *tls.Config
  70. shouldStop bool
  71. // lets the ListenerWrapper inform the server that it has stopped:
  72. stopEvent chan bool
  73. // protects atomic update of tlsConfig and shouldStop:
  74. configMutex sync.Mutex // tier 1
  75. }
  76. // Server is the main Oragono server.
  77. type Server struct {
  78. accountAuthenticationEnabled bool
  79. accountRegistration *AccountRegistration
  80. accounts map[string]*ClientAccount
  81. batches *BatchManager
  82. channelRegistrationEnabled bool
  83. channels *ChannelManager
  84. channelRegistry *ChannelRegistry
  85. checkIdent bool
  86. clients *ClientManager
  87. configFilename string
  88. configurableStateMutex sync.RWMutex // tier 1; generic protection for server state modified by rehash()
  89. connectionLimiter *connection_limits.Limiter
  90. connectionThrottler *connection_limits.Throttler
  91. ctime time.Time
  92. defaultChannelModes modes.Modes
  93. dlines *DLineManager
  94. loggingRawIO bool
  95. isupport *isupport.List
  96. klines *KLineManager
  97. languages *languages.Manager
  98. limits Limits
  99. listeners map[string]*ListenerWrapper
  100. logger *logger.Manager
  101. MaxSendQBytes uint64
  102. monitorManager *MonitorManager
  103. motdLines []string
  104. name string
  105. nameCasefolded string
  106. networkName string
  107. operators map[string]Oper
  108. operclasses map[string]OperClass
  109. password []byte
  110. passwords *passwd.SaltedManager
  111. recoverFromErrors bool
  112. rehashMutex sync.Mutex // tier 3
  113. rehashSignal chan os.Signal
  114. proxyAllowedFrom []string
  115. signals chan os.Signal
  116. snomasks *SnoManager
  117. store *buntdb.DB
  118. stsEnabled bool
  119. webirc []webircConfig
  120. whoWas *WhoWasList
  121. }
  122. var (
  123. // ServerExitSignals are the signals the server will exit on.
  124. ServerExitSignals = []os.Signal{
  125. syscall.SIGINT,
  126. syscall.SIGTERM,
  127. syscall.SIGQUIT,
  128. }
  129. )
  130. type clientConn struct {
  131. Conn net.Conn
  132. IsTLS bool
  133. }
  134. // NewServer returns a new Oragono server.
  135. func NewServer(config *Config, logger *logger.Manager) (*Server, error) {
  136. // initialize data structures
  137. server := &Server{
  138. accounts: make(map[string]*ClientAccount),
  139. batches: NewBatchManager(),
  140. channels: NewChannelManager(),
  141. clients: NewClientManager(),
  142. connectionLimiter: connection_limits.NewLimiter(),
  143. connectionThrottler: connection_limits.NewThrottler(),
  144. languages: languages.NewManager(config.Languages.Default, config.Languages.Data),
  145. listeners: make(map[string]*ListenerWrapper),
  146. logger: logger,
  147. monitorManager: NewMonitorManager(),
  148. rehashSignal: make(chan os.Signal, 1),
  149. signals: make(chan os.Signal, len(ServerExitSignals)),
  150. snomasks: NewSnoManager(),
  151. whoWas: NewWhoWasList(config.Limits.WhowasEntries),
  152. }
  153. if err := server.applyConfig(config, true); err != nil {
  154. return nil, err
  155. }
  156. // generate help info
  157. if err := GenerateHelpIndices(server.languages); err != nil {
  158. return nil, err
  159. }
  160. // Attempt to clean up when receiving these signals.
  161. signal.Notify(server.signals, ServerExitSignals...)
  162. signal.Notify(server.rehashSignal, syscall.SIGHUP)
  163. return server, nil
  164. }
  165. // setISupport sets up our RPL_ISUPPORT reply.
  166. func (server *Server) setISupport() {
  167. maxTargetsString := strconv.Itoa(maxTargets)
  168. server.configurableStateMutex.RLock()
  169. // add RPL_ISUPPORT tokens
  170. isupport := isupport.NewList()
  171. isupport.Add("AWAYLEN", strconv.Itoa(server.limits.AwayLen))
  172. isupport.Add("CASEMAPPING", "ascii")
  173. isupport.Add("CHANMODES", strings.Join([]string{modes.Modes{modes.BanMask, modes.ExceptMask, modes.InviteMask}.String(), "", modes.Modes{modes.UserLimit, modes.Key}.String(), modes.Modes{modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.ChanRoleplaying, modes.Secret}.String()}, ","))
  174. isupport.Add("CHANNELLEN", strconv.Itoa(server.limits.ChannelLen))
  175. isupport.Add("CHANTYPES", "#")
  176. isupport.Add("ELIST", "U")
  177. isupport.Add("EXCEPTS", "")
  178. isupport.Add("INVEX", "")
  179. isupport.Add("KICKLEN", strconv.Itoa(server.limits.KickLen))
  180. isupport.Add("MAXLIST", fmt.Sprintf("beI:%s", strconv.Itoa(server.limits.ChanListModes)))
  181. isupport.Add("MAXTARGETS", maxTargetsString)
  182. isupport.Add("MODES", "")
  183. isupport.Add("MONITOR", strconv.Itoa(server.limits.MonitorEntries))
  184. isupport.Add("NETWORK", server.networkName)
  185. isupport.Add("NICKLEN", strconv.Itoa(server.limits.NickLen))
  186. isupport.Add("PREFIX", "(qaohv)~&@%+")
  187. isupport.Add("RPCHAN", "E")
  188. isupport.Add("RPUSER", "E")
  189. isupport.Add("STATUSMSG", "~&@%+")
  190. isupport.Add("TARGMAX", fmt.Sprintf("NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:%s,TAGMSG:%s,NOTICE:%s,MONITOR:", maxTargetsString, maxTargetsString, maxTargetsString))
  191. isupport.Add("TOPICLEN", strconv.Itoa(server.limits.TopicLen))
  192. isupport.Add("UTF8MAPPING", casemappingName)
  193. // account registration
  194. if server.accountRegistration.Enabled {
  195. // 'none' isn't shown in the REGCALLBACKS vars
  196. var enabledCallbacks []string
  197. for _, name := range server.accountRegistration.EnabledCallbacks {
  198. if name != "*" {
  199. enabledCallbacks = append(enabledCallbacks, name)
  200. }
  201. }
  202. isupport.Add("REGCOMMANDS", "CREATE,VERIFY")
  203. isupport.Add("REGCALLBACKS", strings.Join(enabledCallbacks, ","))
  204. isupport.Add("REGCREDTYPES", "passphrase,certfp")
  205. }
  206. server.configurableStateMutex.RUnlock()
  207. isupport.RegenerateCachedReply()
  208. server.configurableStateMutex.Lock()
  209. server.isupport = isupport
  210. server.configurableStateMutex.Unlock()
  211. }
  212. func loadChannelList(channel *Channel, list string, maskMode modes.Mode) {
  213. if list == "" {
  214. return
  215. }
  216. channel.lists[maskMode].AddAll(strings.Split(list, " "))
  217. }
  218. // Shutdown shuts down the server.
  219. func (server *Server) Shutdown() {
  220. //TODO(dan): Make sure we disallow new nicks
  221. for _, client := range server.clients.AllClients() {
  222. client.Notice("Server is shutting down")
  223. }
  224. if err := server.store.Close(); err != nil {
  225. server.logger.Error("shutdown", fmt.Sprintln("Could not close datastore:", err))
  226. }
  227. }
  228. // Run starts the server.
  229. func (server *Server) Run() {
  230. // defer closing db/store
  231. defer server.store.Close()
  232. for {
  233. select {
  234. case <-server.signals:
  235. server.Shutdown()
  236. return
  237. case <-server.rehashSignal:
  238. go func() {
  239. server.logger.Info("rehash", "Rehashing due to SIGHUP")
  240. err := server.rehash()
  241. if err != nil {
  242. server.logger.Error("rehash", fmt.Sprintln("Failed to rehash:", err.Error()))
  243. }
  244. }()
  245. }
  246. }
  247. }
  248. func (server *Server) acceptClient(conn clientConn) {
  249. // check IP address
  250. ipaddr := utils.AddrToIP(conn.Conn.RemoteAddr())
  251. if ipaddr != nil {
  252. isBanned, banMsg := server.checkBans(ipaddr)
  253. if isBanned {
  254. // this might not show up properly on some clients, but our objective here is just to close the connection out before it has a load impact on us
  255. conn.Conn.Write([]byte(fmt.Sprintf(errorMsg, banMsg)))
  256. conn.Conn.Close()
  257. return
  258. }
  259. }
  260. server.logger.Debug("localconnect-ip", fmt.Sprintf("Client connecting from %v", ipaddr))
  261. // prolly don't need to alert snomasks on this, only on connection reg
  262. NewClient(server, conn.Conn, conn.IsTLS)
  263. }
  264. func (server *Server) checkBans(ipaddr net.IP) (banned bool, message string) {
  265. // check DLINEs
  266. isBanned, info := server.dlines.CheckIP(ipaddr)
  267. if isBanned {
  268. server.logger.Info("localconnect-ip", fmt.Sprintf("Client from %v rejected by d-line", ipaddr))
  269. return true, info.BanMessage("You are banned from this server (%s)")
  270. }
  271. // check connection limits
  272. err := server.connectionLimiter.AddClient(ipaddr, false)
  273. if err != nil {
  274. // too many connections from one client, tell the client and close the connection
  275. server.logger.Info("localconnect-ip", fmt.Sprintf("Client from %v rejected for connection limit", ipaddr))
  276. return true, "Too many clients from your network"
  277. }
  278. // check connection throttle
  279. err = server.connectionThrottler.AddClient(ipaddr)
  280. if err != nil {
  281. // too many connections too quickly from client, tell them and close the connection
  282. duration := server.connectionThrottler.BanDuration()
  283. length := &IPRestrictTime{
  284. Duration: duration,
  285. Expires: time.Now().Add(duration),
  286. }
  287. server.dlines.AddIP(ipaddr, length, server.connectionThrottler.BanMessage(), "Exceeded automated connection throttle", "auto.connection.throttler")
  288. // they're DLINE'd for 15 minutes or whatever, so we can reset the connection throttle now,
  289. // and once their temporary DLINE is finished they can fill up the throttler again
  290. server.connectionThrottler.ResetFor(ipaddr)
  291. // this might not show up properly on some clients, but our objective here is just to close it out before it has a load impact on us
  292. server.logger.Info(
  293. "localconnect-ip",
  294. fmt.Sprintf("Client from %v exceeded connection throttle, d-lining for %v", ipaddr, duration))
  295. return true, server.connectionThrottler.BanMessage()
  296. }
  297. return false, ""
  298. }
  299. //
  300. // IRC protocol listeners
  301. //
  302. // createListener starts the given listeners.
  303. func (server *Server) createListener(addr string, tlsConfig *tls.Config) *ListenerWrapper {
  304. // make listener
  305. var listener net.Listener
  306. var err error
  307. optionalUnixPrefix := "unix:"
  308. optionalPrefixLen := len(optionalUnixPrefix)
  309. if len(addr) >= optionalPrefixLen && strings.ToLower(addr[0:optionalPrefixLen]) == optionalUnixPrefix {
  310. addr = addr[optionalPrefixLen:]
  311. if len(addr) == 0 || addr[0] != '/' {
  312. log.Fatal("Bad unix socket address", addr)
  313. }
  314. }
  315. if len(addr) > 0 && addr[0] == '/' {
  316. // https://stackoverflow.com/a/34881585
  317. os.Remove(addr)
  318. listener, err = net.Listen("unix", addr)
  319. } else {
  320. listener, err = net.Listen("tcp", addr)
  321. }
  322. if err != nil {
  323. log.Fatal(server, "listen error: ", err)
  324. }
  325. // throw our details to the server so we can be modified/killed later
  326. wrapper := ListenerWrapper{
  327. listener: listener,
  328. tlsConfig: tlsConfig,
  329. shouldStop: false,
  330. stopEvent: make(chan bool, 1),
  331. }
  332. var shouldStop bool
  333. // setup accept goroutine
  334. go func() {
  335. for {
  336. conn, err := listener.Accept()
  337. // synchronously access config data:
  338. // whether TLS is enabled and whether we should stop listening
  339. wrapper.configMutex.Lock()
  340. shouldStop = wrapper.shouldStop
  341. tlsConfig = wrapper.tlsConfig
  342. wrapper.configMutex.Unlock()
  343. if err == nil {
  344. if tlsConfig != nil {
  345. conn = tls.Server(conn, tlsConfig)
  346. }
  347. newConn := clientConn{
  348. Conn: conn,
  349. IsTLS: tlsConfig != nil,
  350. }
  351. // hand off the connection
  352. go server.acceptClient(newConn)
  353. }
  354. if shouldStop {
  355. listener.Close()
  356. wrapper.stopEvent <- true
  357. return
  358. }
  359. }
  360. }()
  361. return &wrapper
  362. }
  363. // generateMessageID returns a network-unique message ID.
  364. func (server *Server) generateMessageID() string {
  365. // we don't need the full like 30 chars since the unixnano below handles
  366. // most of our uniqueness requirements, so just truncate at 5
  367. lastbit := strconv.FormatInt(rand.Int63(), 36)
  368. if 5 < len(lastbit) {
  369. lastbit = lastbit[:4]
  370. }
  371. return fmt.Sprintf("%s%s", strconv.FormatInt(time.Now().UTC().UnixNano(), 36), lastbit)
  372. }
  373. //
  374. // server functionality
  375. //
  376. func (server *Server) tryRegister(c *Client) {
  377. if c.registered || !c.HasNick() || !c.HasUsername() ||
  378. (c.capState == caps.NegotiatingState) {
  379. return
  380. }
  381. // check KLINEs
  382. isBanned, info := server.klines.CheckMasks(c.AllNickmasks()...)
  383. if isBanned {
  384. reason := info.Reason
  385. if info.Time != nil {
  386. reason += fmt.Sprintf(" [%s]", info.Time.Duration.String())
  387. }
  388. c.Quit(fmt.Sprintf(c.t("You are banned from this server (%s)"), reason))
  389. c.destroy(false)
  390. return
  391. }
  392. // continue registration
  393. server.logger.Debug("localconnect", fmt.Sprintf("Client registered [%s] [u:%s] [r:%s]", c.nick, c.username, c.realname))
  394. server.snomasks.Send(sno.LocalConnects, fmt.Sprintf(ircfmt.Unescape("Client registered $c[grey][$r%s$c[grey]] [u:$r%s$c[grey]] [h:$r%s$c[grey]] [r:$r%s$c[grey]]"), c.nick, c.username, c.rawHostname, c.realname))
  395. c.Register()
  396. // send welcome text
  397. //NOTE(dan): we specifically use the NICK here instead of the nickmask
  398. // see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
  399. c.Send(nil, server.name, RPL_WELCOME, c.nick, fmt.Sprintf(c.t("Welcome to the Internet Relay Network %s"), c.nick))
  400. c.Send(nil, server.name, RPL_YOURHOST, c.nick, fmt.Sprintf(c.t("Your host is %[1]s, running version %[2]s"), server.name, Ver))
  401. c.Send(nil, server.name, RPL_CREATED, c.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
  402. //TODO(dan): Look at adding last optional [<channel modes with a parameter>] parameter
  403. c.Send(nil, server.name, RPL_MYINFO, c.nick, server.name, Ver, supportedUserModesString, supportedChannelModesString)
  404. rb := NewResponseBuffer(c)
  405. c.RplISupport(rb)
  406. server.MOTD(c, rb)
  407. rb.Send()
  408. c.Send(nil, c.nickMaskString, RPL_UMODEIS, c.nick, c.ModeString())
  409. if server.logger.IsLoggingRawIO() {
  410. c.Notice(c.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
  411. }
  412. // if resumed, send fake channel joins
  413. if c.resumeDetails != nil {
  414. for _, name := range c.resumeDetails.SendFakeJoinsFor {
  415. channel := server.channels.Get(name)
  416. if channel == nil {
  417. continue
  418. }
  419. if c.capabilities.Has(caps.ExtendedJoin) {
  420. c.Send(nil, c.nickMaskString, "JOIN", channel.name, c.account.Name, c.realname)
  421. } else {
  422. c.Send(nil, c.nickMaskString, "JOIN", channel.name)
  423. }
  424. // reuse the last rb
  425. channel.SendTopic(c, rb)
  426. channel.Names(c, rb)
  427. rb.Send()
  428. // construct and send fake modestring if necessary
  429. c.stateMutex.RLock()
  430. myModes := channel.members[c]
  431. c.stateMutex.RUnlock()
  432. if myModes == nil {
  433. continue
  434. }
  435. oldModes := myModes.String()
  436. if 0 < len(oldModes) {
  437. params := []string{channel.name, "+" + oldModes}
  438. for range oldModes {
  439. params = append(params, c.nick)
  440. }
  441. c.Send(nil, server.name, "MODE", params...)
  442. }
  443. }
  444. }
  445. }
  446. // t returns the translated version of the given string, based on the languages configured by the client.
  447. func (client *Client) t(originalString string) string {
  448. // grab this mutex to protect client.languages
  449. client.stateMutex.RLock()
  450. defer client.stateMutex.RUnlock()
  451. return client.server.languages.Translate(client.languages, originalString)
  452. }
  453. // MOTD serves the Message of the Day.
  454. func (server *Server) MOTD(client *Client, rb *ResponseBuffer) {
  455. server.configurableStateMutex.RLock()
  456. motdLines := server.motdLines
  457. server.configurableStateMutex.RUnlock()
  458. if len(motdLines) < 1 {
  459. rb.Add(nil, server.name, ERR_NOMOTD, client.nick, client.t("MOTD File is missing"))
  460. return
  461. }
  462. rb.Add(nil, server.name, RPL_MOTDSTART, client.nick, fmt.Sprintf(client.t("- %s Message of the day - "), server.name))
  463. for _, line := range motdLines {
  464. rb.Add(nil, server.name, RPL_MOTD, client.nick, line)
  465. }
  466. rb.Add(nil, server.name, RPL_ENDOFMOTD, client.nick, client.t("End of MOTD command"))
  467. }
  468. // wordWrap wraps the given text into a series of lines that don't exceed lineWidth characters.
  469. func wordWrap(text string, lineWidth int) []string {
  470. var lines []string
  471. var cacheLine, cacheWord string
  472. for _, char := range text {
  473. if char == '\r' {
  474. continue
  475. } else if char == '\n' {
  476. cacheLine += cacheWord
  477. lines = append(lines, cacheLine)
  478. cacheWord = ""
  479. cacheLine = ""
  480. } else if (char == ' ' || char == '-') && len(cacheLine)+len(cacheWord)+1 < lineWidth {
  481. // natural word boundary
  482. cacheLine += cacheWord + string(char)
  483. cacheWord = ""
  484. } else if lineWidth <= len(cacheLine)+len(cacheWord)+1 {
  485. // time to wrap to next line
  486. if len(cacheLine) < (lineWidth / 2) {
  487. // this word takes up more than half a line... just split in the middle of the word
  488. cacheLine += cacheWord + string(char)
  489. cacheWord = ""
  490. } else {
  491. cacheWord += string(char)
  492. }
  493. lines = append(lines, cacheLine)
  494. cacheLine = ""
  495. } else {
  496. // normal character
  497. cacheWord += string(char)
  498. }
  499. }
  500. if 0 < len(cacheWord) {
  501. cacheLine += cacheWord
  502. }
  503. if 0 < len(cacheLine) {
  504. lines = append(lines, cacheLine)
  505. }
  506. return lines
  507. }
  508. // SplitMessage represents a message that's been split for sending.
  509. type SplitMessage struct {
  510. For512 []string
  511. ForMaxLine string
  512. }
  513. func (server *Server) splitMessage(original string, origIs512 bool) SplitMessage {
  514. var newSplit SplitMessage
  515. newSplit.ForMaxLine = original
  516. if !origIs512 {
  517. newSplit.For512 = wordWrap(original, 400)
  518. } else {
  519. newSplit.For512 = []string{original}
  520. }
  521. return newSplit
  522. }
  523. // WhoisChannelsNames returns the common channel names between two users.
  524. func (client *Client) WhoisChannelsNames(target *Client) []string {
  525. isMultiPrefix := target.capabilities.Has(caps.MultiPrefix)
  526. var chstrs []string
  527. for _, channel := range client.Channels() {
  528. // channel is secret and the target can't see it
  529. if !target.flags[modes.Operator] && channel.HasMode(modes.Secret) && !channel.hasClient(target) {
  530. continue
  531. }
  532. chstrs = append(chstrs, channel.ClientPrefixes(client, isMultiPrefix)+channel.name)
  533. }
  534. return chstrs
  535. }
  536. func (client *Client) getWhoisOf(target *Client, rb *ResponseBuffer) {
  537. target.stateMutex.RLock()
  538. defer target.stateMutex.RUnlock()
  539. rb.Add(nil, client.server.name, RPL_WHOISUSER, client.nick, target.nick, target.username, target.hostname, "*", target.realname)
  540. whoischannels := client.WhoisChannelsNames(target)
  541. if whoischannels != nil {
  542. rb.Add(nil, client.server.name, RPL_WHOISCHANNELS, client.nick, target.nick, strings.Join(whoischannels, " "))
  543. }
  544. if target.class != nil {
  545. rb.Add(nil, client.server.name, RPL_WHOISOPERATOR, client.nick, target.nick, target.whoisLine)
  546. }
  547. if client.flags[modes.Operator] || client == target {
  548. rb.Add(nil, client.server.name, RPL_WHOISACTUALLY, client.nick, target.nick, fmt.Sprintf("%s@%s", target.username, utils.LookupHostname(target.IPString())), target.IPString(), client.t("Actual user@host, Actual IP"))
  549. }
  550. if target.flags[modes.TLS] {
  551. rb.Add(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, client.t("is using a secure connection"))
  552. }
  553. accountName := target.AccountName()
  554. if accountName != "" {
  555. rb.Add(nil, client.server.name, RPL_WHOISACCOUNT, client.nick, accountName, client.t("is logged in as"))
  556. }
  557. if target.flags[modes.Bot] {
  558. rb.Add(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape(fmt.Sprintf(client.t("is a $bBot$b on %s"), client.server.networkName)))
  559. }
  560. if 0 < len(target.languages) {
  561. params := []string{client.nick, target.nick}
  562. for _, str := range client.server.languages.Codes(target.languages) {
  563. params = append(params, str)
  564. }
  565. params = append(params, client.t("can speak these languages"))
  566. rb.Add(nil, client.server.name, RPL_WHOISLANGUAGE, params...)
  567. }
  568. if target.certfp != "" && (client.flags[modes.Operator] || client == target) {
  569. rb.Add(nil, client.server.name, RPL_WHOISCERTFP, client.nick, target.nick, fmt.Sprintf(client.t("has client certificate fingerprint %s"), target.certfp))
  570. }
  571. rb.Add(nil, client.server.name, RPL_WHOISIDLE, client.nick, target.nick, strconv.FormatUint(target.IdleSeconds(), 10), strconv.FormatInt(target.SignonTime(), 10), client.t("seconds idle, signon time"))
  572. }
  573. // rplWhoReply returns the WHO reply between one user and another channel/user.
  574. // <channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ]
  575. // :<hopcount> <real name>
  576. func (target *Client) rplWhoReply(channel *Channel, client *Client, rb *ResponseBuffer) {
  577. channelName := "*"
  578. flags := ""
  579. if client.HasMode(modes.Away) {
  580. flags = "G"
  581. } else {
  582. flags = "H"
  583. }
  584. if client.HasMode(modes.Operator) {
  585. flags += "*"
  586. }
  587. if channel != nil {
  588. flags += channel.ClientPrefixes(client, target.capabilities.Has(caps.MultiPrefix))
  589. channelName = channel.name
  590. }
  591. rb.Add(nil, target.server.name, RPL_WHOREPLY, target.nick, channelName, client.Username(), client.Hostname(), client.server.name, client.Nick(), flags, strconv.Itoa(client.hops)+" "+client.Realname())
  592. }
  593. func whoChannel(client *Client, channel *Channel, friends ClientSet, rb *ResponseBuffer) {
  594. for _, member := range channel.Members() {
  595. if !client.flags[modes.Invisible] || friends[client] {
  596. client.rplWhoReply(channel, member, rb)
  597. }
  598. }
  599. }
  600. // rehash reloads the config and applies the changes from the config file.
  601. func (server *Server) rehash() error {
  602. server.logger.Debug("rehash", "Starting rehash")
  603. // only let one REHASH go on at a time
  604. server.rehashMutex.Lock()
  605. defer server.rehashMutex.Unlock()
  606. server.logger.Debug("rehash", "Got rehash lock")
  607. config, err := LoadConfig(server.configFilename)
  608. if err != nil {
  609. return fmt.Errorf("Error loading config file config: %s", err.Error())
  610. }
  611. err = server.applyConfig(config, false)
  612. if err != nil {
  613. return fmt.Errorf("Error applying config changes: %s", err.Error())
  614. }
  615. return nil
  616. }
  617. func (server *Server) applyConfig(config *Config, initial bool) error {
  618. if initial {
  619. server.ctime = time.Now()
  620. server.configFilename = config.Filename
  621. } else {
  622. // enforce configs that can't be changed after launch:
  623. if server.limits.LineLen.Tags != config.Limits.LineLen.Tags || server.limits.LineLen.Rest != config.Limits.LineLen.Rest {
  624. return fmt.Errorf("Maximum line length (linelen) cannot be changed after launching the server, rehash aborted")
  625. } else if server.name != config.Server.Name {
  626. return fmt.Errorf("Server name cannot be changed after launching the server, rehash aborted")
  627. }
  628. }
  629. casefoldedName, err := Casefold(config.Server.Name)
  630. if err != nil {
  631. return fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
  632. }
  633. // confirm operator stuff all exists and is fine
  634. operclasses, err := config.OperatorClasses()
  635. if err != nil {
  636. return fmt.Errorf("Error rehashing config file operclasses: %s", err.Error())
  637. }
  638. opers, err := config.Operators(operclasses)
  639. if err != nil {
  640. return fmt.Errorf("Error rehashing config file opers: %s", err.Error())
  641. }
  642. // TODO: support rehash of existing operator perms?
  643. // sanity checks complete, start modifying server state
  644. if initial {
  645. server.name = config.Server.Name
  646. server.nameCasefolded = casefoldedName
  647. }
  648. server.configurableStateMutex.Lock()
  649. server.networkName = config.Network.Name
  650. if config.Server.Password != "" {
  651. server.password = config.Server.PasswordBytes()
  652. } else {
  653. server.password = nil
  654. }
  655. // apply new WebIRC command restrictions
  656. server.webirc = config.Server.WebIRC
  657. // apply new PROXY command restrictions
  658. server.proxyAllowedFrom = config.Server.ProxyAllowedFrom
  659. server.recoverFromErrors = true
  660. if config.Debug.RecoverFromErrors != nil {
  661. server.recoverFromErrors = *config.Debug.RecoverFromErrors
  662. }
  663. server.configurableStateMutex.Unlock()
  664. err = server.connectionLimiter.ApplyConfig(config.Server.ConnectionLimiter)
  665. if err != nil {
  666. return err
  667. }
  668. err = server.connectionThrottler.ApplyConfig(config.Server.ConnectionThrottler)
  669. if err != nil {
  670. return err
  671. }
  672. // setup new and removed caps
  673. addedCaps := caps.NewSet()
  674. removedCaps := caps.NewSet()
  675. updatedCaps := caps.NewSet()
  676. // Translations
  677. currentLanguageValue, _ := CapValues.Get(caps.Languages)
  678. langCodes := []string{strconv.Itoa(len(config.Languages.Data) + 1), "en"}
  679. for _, info := range config.Languages.Data {
  680. if info.Incomplete {
  681. langCodes = append(langCodes, "~"+info.Code)
  682. } else {
  683. langCodes = append(langCodes, info.Code)
  684. }
  685. }
  686. newLanguageValue := strings.Join(langCodes, ",")
  687. server.logger.Debug("rehash", "Languages:", newLanguageValue)
  688. if currentLanguageValue != newLanguageValue {
  689. updatedCaps.Add(caps.Languages)
  690. CapValues.Set(caps.Languages, newLanguageValue)
  691. }
  692. lm := languages.NewManager(config.Languages.Default, config.Languages.Data)
  693. server.logger.Debug("rehash", "Regenerating HELP indexes for new languages")
  694. GenerateHelpIndices(lm)
  695. server.languages = lm
  696. // SASL
  697. if config.Accounts.AuthenticationEnabled && !server.accountAuthenticationEnabled {
  698. // enabling SASL
  699. SupportedCapabilities.Enable(caps.SASL)
  700. CapValues.Set(caps.SASL, "PLAIN,EXTERNAL")
  701. addedCaps.Add(caps.SASL)
  702. }
  703. if !config.Accounts.AuthenticationEnabled && server.accountAuthenticationEnabled {
  704. // disabling SASL
  705. SupportedCapabilities.Disable(caps.SASL)
  706. removedCaps.Add(caps.SASL)
  707. }
  708. server.accountAuthenticationEnabled = config.Accounts.AuthenticationEnabled
  709. // STS
  710. stsValue := config.Server.STS.Value()
  711. var stsDisabled bool
  712. stsCurrentCapValue, _ := CapValues.Get(caps.STS)
  713. server.logger.Debug("rehash", "STS Vals", stsCurrentCapValue, stsValue, fmt.Sprintf("server[%v] config[%v]", server.stsEnabled, config.Server.STS.Enabled))
  714. if config.Server.STS.Enabled && !server.stsEnabled {
  715. // enabling STS
  716. SupportedCapabilities.Enable(caps.STS)
  717. addedCaps.Add(caps.STS)
  718. CapValues.Set(caps.STS, stsValue)
  719. } else if !config.Server.STS.Enabled && server.stsEnabled {
  720. // disabling STS
  721. SupportedCapabilities.Disable(caps.STS)
  722. removedCaps.Add(caps.STS)
  723. stsDisabled = true
  724. } else if config.Server.STS.Enabled && server.stsEnabled && stsValue != stsCurrentCapValue {
  725. // STS policy updated
  726. CapValues.Set(caps.STS, stsValue)
  727. updatedCaps.Add(caps.STS)
  728. }
  729. server.stsEnabled = config.Server.STS.Enabled
  730. // burst new and removed caps
  731. var capBurstClients ClientSet
  732. added := make(map[caps.Version]string)
  733. var removed string
  734. // updated caps get DEL'd and then NEW'd
  735. // so, we can just add updated ones to both removed and added lists here and they'll be correctly handled
  736. server.logger.Debug("rehash", "Updated Caps", updatedCaps.String(caps.Cap301, CapValues), strconv.Itoa(updatedCaps.Count()))
  737. for _, capab := range updatedCaps.List() {
  738. addedCaps.Enable(capab)
  739. removedCaps.Enable(capab)
  740. }
  741. if 0 < addedCaps.Count() || 0 < removedCaps.Count() {
  742. capBurstClients = server.clients.AllWithCaps(caps.CapNotify)
  743. added[caps.Cap301] = addedCaps.String(caps.Cap301, CapValues)
  744. added[caps.Cap302] = addedCaps.String(caps.Cap302, CapValues)
  745. // removed never has values, so we leave it as Cap301
  746. removed = removedCaps.String(caps.Cap301, CapValues)
  747. }
  748. for sClient := range capBurstClients {
  749. if stsDisabled {
  750. // remove STS policy
  751. //TODO(dan): this is an ugly hack. we can write this better.
  752. stsPolicy := "sts=duration=0"
  753. if 0 < addedCaps.Count() {
  754. added[caps.Cap302] = added[caps.Cap302] + " " + stsPolicy
  755. } else {
  756. addedCaps.Enable(caps.STS)
  757. added[caps.Cap302] = stsPolicy
  758. }
  759. }
  760. // DEL caps and then send NEW ones so that updated caps get removed/added correctly
  761. if 0 < removedCaps.Count() {
  762. sClient.Send(nil, server.name, "CAP", sClient.nick, "DEL", removed)
  763. }
  764. if 0 < addedCaps.Count() {
  765. sClient.Send(nil, server.name, "CAP", sClient.nick, "NEW", added[sClient.capVersion])
  766. }
  767. }
  768. // set server options
  769. server.configurableStateMutex.Lock()
  770. lineLenConfig := LineLenLimits{
  771. Tags: config.Limits.LineLen.Tags,
  772. Rest: config.Limits.LineLen.Rest,
  773. }
  774. server.limits = Limits{
  775. AwayLen: int(config.Limits.AwayLen),
  776. ChannelLen: int(config.Limits.ChannelLen),
  777. KickLen: int(config.Limits.KickLen),
  778. MonitorEntries: int(config.Limits.MonitorEntries),
  779. NickLen: int(config.Limits.NickLen),
  780. TopicLen: int(config.Limits.TopicLen),
  781. ChanListModes: int(config.Limits.ChanListModes),
  782. LineLen: lineLenConfig,
  783. }
  784. server.operclasses = *operclasses
  785. server.operators = opers
  786. server.checkIdent = config.Server.CheckIdent
  787. // registration
  788. accountReg := NewAccountRegistration(config.Accounts.Registration)
  789. server.accountRegistration = &accountReg
  790. server.channelRegistrationEnabled = config.Channels.Registration.Enabled
  791. server.defaultChannelModes = ParseDefaultChannelModes(config)
  792. server.configurableStateMutex.Unlock()
  793. // set new sendqueue size
  794. if config.Server.MaxSendQBytes != server.MaxSendQBytes {
  795. server.configurableStateMutex.Lock()
  796. server.MaxSendQBytes = config.Server.MaxSendQBytes
  797. server.configurableStateMutex.Unlock()
  798. // update on all clients
  799. for _, sClient := range server.clients.AllClients() {
  800. sClient.socket.MaxSendQBytes = config.Server.MaxSendQBytes
  801. }
  802. }
  803. // set RPL_ISUPPORT
  804. var newISupportReplies [][]string
  805. oldISupportList := server.isupport
  806. server.setISupport()
  807. if oldISupportList != nil {
  808. newISupportReplies = oldISupportList.GetDifference(server.isupport)
  809. }
  810. server.loadMOTD(config.Server.MOTD, config.Server.MOTDFormatting)
  811. // reload logging config
  812. err = server.logger.ApplyConfig(config.Logging)
  813. if err != nil {
  814. return err
  815. }
  816. nowLoggingRawIO := server.logger.IsLoggingRawIO()
  817. // notify clients if raw i/o logging was enabled by a rehash
  818. sendRawOutputNotice := !initial && !server.loggingRawIO && nowLoggingRawIO
  819. server.loggingRawIO = nowLoggingRawIO
  820. if initial {
  821. if err := server.loadDatastore(config.Datastore.Path); err != nil {
  822. return err
  823. }
  824. }
  825. // we are now open for business
  826. server.setupListeners(config)
  827. if !initial {
  828. // push new info to all of our clients
  829. for _, sClient := range server.clients.AllClients() {
  830. for _, tokenline := range newISupportReplies {
  831. sClient.Send(nil, server.name, RPL_ISUPPORT, append([]string{sClient.nick}, tokenline...)...)
  832. }
  833. if sendRawOutputNotice {
  834. sClient.Notice(sClient.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
  835. }
  836. }
  837. }
  838. return nil
  839. }
  840. func (server *Server) loadMOTD(motdPath string, useFormatting bool) error {
  841. server.logger.Debug("rehash", "Loading MOTD")
  842. motdLines := make([]string, 0)
  843. if motdPath != "" {
  844. file, err := os.Open(motdPath)
  845. if err == nil {
  846. defer file.Close()
  847. reader := bufio.NewReader(file)
  848. for {
  849. line, err := reader.ReadString('\n')
  850. if err != nil {
  851. break
  852. }
  853. line = strings.TrimRight(line, "\r\n")
  854. if useFormatting {
  855. line = ircfmt.Unescape(line)
  856. }
  857. // "- " is the required prefix for MOTD, we just add it here to make
  858. // bursting it out to clients easier
  859. line = fmt.Sprintf("- %s", line)
  860. motdLines = append(motdLines, line)
  861. }
  862. } else {
  863. return err
  864. }
  865. }
  866. server.configurableStateMutex.Lock()
  867. server.motdLines = motdLines
  868. server.configurableStateMutex.Unlock()
  869. return nil
  870. }
  871. func (server *Server) loadDatastore(datastorePath string) error {
  872. // open the datastore and load server state for which it (rather than config)
  873. // is the source of truth
  874. server.logger.Debug("startup", "Opening datastore")
  875. db, err := OpenDatabase(datastorePath)
  876. if err == nil {
  877. server.store = db
  878. } else {
  879. return fmt.Errorf("Failed to open datastore: %s", err.Error())
  880. }
  881. // load *lines (from the datastores)
  882. server.logger.Debug("startup", "Loading D/Klines")
  883. server.loadDLines()
  884. server.loadKLines()
  885. // load password manager
  886. server.logger.Debug("startup", "Loading passwords")
  887. err = server.store.View(func(tx *buntdb.Tx) error {
  888. saltString, err := tx.Get(keySalt)
  889. if err != nil {
  890. return fmt.Errorf("Could not retrieve salt string: %s", err.Error())
  891. }
  892. salt, err := base64.StdEncoding.DecodeString(saltString)
  893. if err != nil {
  894. return err
  895. }
  896. pwm := passwd.NewSaltedManager(salt)
  897. server.passwords = &pwm
  898. return nil
  899. })
  900. if err != nil {
  901. return fmt.Errorf("Could not load salt: %s", err.Error())
  902. }
  903. server.channelRegistry = NewChannelRegistry(server)
  904. return nil
  905. }
  906. func (server *Server) setupListeners(config *Config) {
  907. logListener := func(addr string, tlsconfig *tls.Config) {
  908. server.logger.Info("listeners",
  909. fmt.Sprintf("now listening on %s, tls=%t.", addr, (tlsconfig != nil)),
  910. )
  911. }
  912. // update or destroy all existing listeners
  913. tlsListeners := config.TLSListeners()
  914. for addr := range server.listeners {
  915. currentListener := server.listeners[addr]
  916. var stillConfigured bool
  917. for _, newaddr := range config.Server.Listen {
  918. if newaddr == addr {
  919. stillConfigured = true
  920. break
  921. }
  922. }
  923. // pass new config information to the listener, to be picked up after
  924. // its next Accept(). this is like sending over a buffered channel of
  925. // size 1, but where sending a second item overwrites the buffered item
  926. // instead of blocking.
  927. currentListener.configMutex.Lock()
  928. currentListener.shouldStop = !stillConfigured
  929. currentListener.tlsConfig = tlsListeners[addr]
  930. currentListener.configMutex.Unlock()
  931. if stillConfigured {
  932. logListener(addr, currentListener.tlsConfig)
  933. } else {
  934. // tell the listener it should stop by interrupting its Accept() call:
  935. currentListener.listener.Close()
  936. // TODO(golang1.10) delete stopEvent once issue #21856 is released
  937. <-currentListener.stopEvent
  938. delete(server.listeners, addr)
  939. server.logger.Info("listeners", fmt.Sprintf("stopped listening on %s.", addr))
  940. }
  941. }
  942. // create new listeners that were not previously configured
  943. for _, newaddr := range config.Server.Listen {
  944. _, exists := server.listeners[newaddr]
  945. if !exists {
  946. // make new listener
  947. tlsConfig := tlsListeners[newaddr]
  948. server.listeners[newaddr] = server.createListener(newaddr, tlsConfig)
  949. logListener(newaddr, tlsConfig)
  950. }
  951. }
  952. if len(tlsListeners) == 0 {
  953. server.logger.Warning("startup", "You are not exposing an SSL/TLS listening port. You should expose at least one port (typically 6697) to accept TLS connections")
  954. }
  955. var usesStandardTLSPort bool
  956. for addr := range config.TLSListeners() {
  957. if strings.Contains(addr, "6697") {
  958. usesStandardTLSPort = true
  959. break
  960. }
  961. }
  962. if 0 < len(tlsListeners) && !usesStandardTLSPort {
  963. server.logger.Warning("startup", "Port 6697 is the standard TLS port for IRC. You should (also) expose port 6697 as a TLS port to ensure clients can connect securely")
  964. }
  965. }
  966. // GetDefaultChannelModes returns our default channel modes.
  967. func (server *Server) GetDefaultChannelModes() modes.Modes {
  968. server.configurableStateMutex.RLock()
  969. defer server.configurableStateMutex.RUnlock()
  970. return server.defaultChannelModes
  971. }
  972. // elistMatcher takes and matches ELIST conditions
  973. type elistMatcher struct {
  974. MinClientsActive bool
  975. MinClients int
  976. MaxClientsActive bool
  977. MaxClients int
  978. }
  979. // Matches checks whether the given channel matches our matches.
  980. func (matcher *elistMatcher) Matches(channel *Channel) bool {
  981. if matcher.MinClientsActive {
  982. if len(channel.Members()) < matcher.MinClients {
  983. return false
  984. }
  985. }
  986. if matcher.MaxClientsActive {
  987. if len(channel.Members()) < len(channel.members) {
  988. return false
  989. }
  990. }
  991. return true
  992. }
  993. // RplList returns the RPL_LIST numeric for the given channel.
  994. func (target *Client) RplList(channel *Channel, rb *ResponseBuffer) {
  995. // get the correct number of channel members
  996. var memberCount int
  997. if target.flags[modes.Operator] || channel.hasClient(target) {
  998. memberCount = len(channel.Members())
  999. } else {
  1000. for _, member := range channel.Members() {
  1001. if !member.HasMode(modes.Invisible) {
  1002. memberCount++
  1003. }
  1004. }
  1005. }
  1006. rb.Add(nil, target.server.name, RPL_LIST, target.nick, channel.name, strconv.Itoa(memberCount), channel.topic)
  1007. }
  1008. // ResumeDetails are the details that we use to resume connections.
  1009. type ResumeDetails struct {
  1010. OldNick string
  1011. Timestamp *time.Time
  1012. SendFakeJoinsFor []string
  1013. }
  1014. var (
  1015. infoString1 = strings.Split(` ▄▄▄ ▄▄▄· ▄▄ • ▐ ▄
  1016. ▪ ▀▄ █·▐█ ▀█ ▐█ ▀ ▪▪ •█▌▐█▪
  1017. ▄█▀▄ ▐▀▀▄ ▄█▀▀█ ▄█ ▀█▄ ▄█▀▄▪▐█▐▐▌ ▄█▀▄
  1018. ▐█▌.▐▌▐█•█▌▐█ ▪▐▌▐█▄▪▐█▐█▌ ▐▌██▐█▌▐█▌.▐▌
  1019. ▀█▄▀▪.▀ ▀ ▀ ▀ ·▀▀▀▀ ▀█▄▀ ▀▀ █▪ ▀█▄▀▪
  1020. https://oragono.io/
  1021. https://github.com/oragono/oragono
  1022. https://crowdin.com/project/oragono
  1023. `, "\n")
  1024. infoString2 = strings.Split(` Daniel Oakley, DanielOaks, <daniel@danieloaks.net>
  1025. Shivaram Lingamneni, slingamn, <slingamn@cs.stanford.edu>
  1026. `, "\n")
  1027. infoString3 = strings.Split(` 3onyc
  1028. Edmund Huber
  1029. Euan Kemp (euank)
  1030. Jeremy Latt
  1031. Martin Lindhe (martinlindhe)
  1032. Roberto Besser (besser)
  1033. Robin Burchell (rburchell)
  1034. Sean Enck (enckse)
  1035. soul9
  1036. Vegax
  1037. `, "\n")
  1038. )