Give me the code to show my respect
Github.com/ItsWewin/go…
At present, there are few functions, welcome to mention the functions you want in the issue, and add the functions required in the issue first. Welcome to ridicule or star
Project introduction
This is a multiplayer online chat program using Golang network programming, using Goroutine to achieve high concurrency, using Redis to save user registration information
The project consists of two parts: the server and the client. The server and client codes are basically independent. The server code is in the server directory, the client code is in the client directory, and the package in the Commen directory is used by the server and the client
The project directory structure is as follows:
. ├ ─ ─ the README. Md ├ ─ ─ client / / client code │ ├ ─ ─ logger / / custom log print │ │ └ ─ ─ logger. Go │ ├ ─ ─ main. Go / / main function │ ├ ─ ─ model / / Model layer │ │ └ ─ ─ user. Go │ ├ ─ ─ the process / / processing connects to the server side, To send and receive messages │ │ ├ ─ ─ messageProcess. Go │ │ ├ ─ ─ serverProcess. Go │ │ └ ─ ─ userProcess. Go │ └ ─ ─ utils │ └ ─ ─ utils. Go ├ ─ ─ commen / / Client and server common code, │ ├─ ├─ go ├─ go, ├─ go, ├─ go, go, go, go, go, go, go, go, go ├ ─ ─ model / / model layer │ ├ ─ ─ clientConn. Go │ ├ ─ ─ error. Go │ ├ ─ ─ user. Go │ └ ─ ─ userDao. Go ├ ─ ─ the process / / processing with the client's connection, To send and receive messages │ ├ ─ ─ groupMessageProcess. Go / / processing group of news │ ├ ─ ─ onlineInfoProcess. Go / / show the online user │ ├ ─ ─ pointToPointMessageProcess. Go / / Process peer-to-peer chat messages │ ├ ─ ─ processor. The go / / message handler entry │ └ ─ ─ userProcess. Go / / processing, and user login registration related news └ ─ ─ utils └ ─ ─ utils. GoCopy the code
Run this project locally (under Unix)
Download the project
Download the project to the local GOPATH directory (go Get will be provided later for easy use). Since this is a Golang project, you need to have a local Golang environment
cd ${GOPATH}/src
git clone [email protected]:ItsWewin/go-chat.git
Copy the code
Compile and run
Compile and run the server-side code
go build -o server go-chat/server/main
./server
Copy the code
Compile and run the client code
go build -o server go-chat/server/main
./server
Copy the code
Then you can experience this project locally (PS: If you don’t want to use wechat or QQ to chat, you can try to set up the level on your own server, and call your friends to chat with this software (manual add facial mask emoticons)).
Project overview
The project has realized the following functions:
- User registration, login
- The list of all online users is displayed
- Sending group messages (currently to all users online)
- Private chat with a user
- Print messages in different colors based on the message type (info, Notice, WARN, Error, success) (both Unix and Windows support this)
- Others will expand when they are free… (Welcome to mention issue, priority implementation mentioned by issue)