func NewClient(name string, conn net.Conn, s *Server) *Client { client := &Client{ name: name, realName: "", server: s, channels: channel.NewChannels(), } handler := connection.Log(name, clientHandler{client}) client.conn = connection.NewConn(conn, handler) log.Println("client started") return client }
func NewServer(name, address, port string) *Server { in := make(chan string) quit := make(chan struct{}) clients := NewClients() channels := channel.NewChannels() return &Server{ address: address, port: port, name: name, in: in, quit: quit, clients: clients, channels: channels, } }