aboutsummaryrefslogblamecommitdiff
path: root/main.go
blob: 86ffa6af0007d8a1753225f6eeac6dde311dc5fc (plain) (tree)
1
2
3
4
5
6
7
8
9
10


            
             
 
                                                      

 

                                
             
                                         
 
                         
                          

                                        

         

                                                   
                                                     





                                              
                                                             
                 
                           
                                          
                                                              
                                       
                                                                                           
                         

                                                  


                   
package main

import (
	"net"

	"go.lindenii.runxiyu.org/lindenii-common/clog"
)

const VERSION = "MeseIRCd-0.0.0"

func main() {
	// TODO: Parse config and add TLS

	self = &server_t{
		conn: nil,
		sid:  0,
		name: "irc.runxiyu.org",
	}

	listener, err := net.Listen("tcp", ":6667")
	if err != nil {
		clog.Fatal(1, "listen", "error", err)
	}
	defer listener.Close()

	for {
		conn, err := listener.Accept()
		if err != nil {
			clog.Fatal(1, "accept", "error", err)
		}
		go func() {
			defer conn.Close()
			client, err := new_local_client(&conn)
			if err != nil {
				clog.Error("new_local_client", "error", err, "conn", &conn)
			}
			defer client.teardown()
			client.handle_connection()
		}()
	}
}