示例#1
0
文件: client.go 项目: Codesleuth/iirc
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
}
示例#2
0
文件: server.go 项目: Codesleuth/iirc
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,
	}
}