-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
104 changed files
with
6,126 additions
and
7,012 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
cd pkg/proto | ||
protoc --go_out=plugins=grpc:../../../ *.proto | ||
cd ../../ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
root_path=$(pwd) | ||
rm -rf pkg/protocol/pb/* | ||
cd pkg/protocol/proto | ||
pb_root_path=$root_path/../ | ||
protoc --proto_path=$root_path/pkg/protocol/proto --go_out=$pb_root_path --go-grpc_out=$pb_root_path *.proto | ||
cd $root_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go | ||
echo "打包完成" | ||
docker run -v $(pwd)/:/app -p 8080:8080 -p 8081:8081 -p 50100:50100 alpine .//app/main | ||
docker run -v $(pwd)/:/app -p 8000:8000 -p 8002:8002 -p 8003:8003 alpine .//app/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package config | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"gim/pkg/grpclib/picker" | ||
"gim/pkg/logger" | ||
"gim/pkg/protocol/pb" | ||
|
||
"go.uber.org/zap" | ||
|
||
_ "gim/pkg/grpclib/resolver/addrs" | ||
|
||
"google.golang.org/grpc" | ||
"google.golang.org/grpc/balancer/roundrobin" | ||
) | ||
|
||
type defaultBuilder struct{} | ||
|
||
func (*defaultBuilder) Build() Configuration { | ||
logger.Level = zap.DebugLevel | ||
logger.Target = logger.Console | ||
|
||
return Configuration{ | ||
MySQL: "root:gim123456@tcp(111.229.238.28:3306)/gim?charset=utf8&parseTime=true", | ||
RedisHost: "111.229.238.28:6379", | ||
RedisPassword: "alber123456", | ||
PushRoomSubscribeNum: 100, | ||
PushAllSubscribeNum: 100, | ||
|
||
ConnectLocalAddr: "127.0.0.1:8000", | ||
ConnectRPCListenAddr: ":8000", | ||
ConnectWSListenAddr: ":8001", | ||
ConnectTCPListenAddr: ":8002", | ||
|
||
LogicRPCListenAddr: ":8010", | ||
BusinessRPCListenAddr: ":8020", | ||
FileHTTPListenAddr: "8030", | ||
|
||
ConnectIntClientBuilder: func() pb.ConnectIntClient { | ||
conn, err := grpc.DialContext(context.TODO(), "addrs:///127.0.0.1:8000", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), | ||
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, picker.AddrPickerName))) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return pb.NewConnectIntClient(conn) | ||
}, | ||
LogicIntClientBuilder: func() pb.LogicIntClient { | ||
conn, err := grpc.DialContext(context.TODO(), "addrs:///docker.for.mac.host.internal:8010", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), | ||
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return pb.NewLogicIntClient(conn) | ||
}, | ||
BusinessIntClientBuilder: func() pb.BusinessIntClient { | ||
conn, err := grpc.DialContext(context.TODO(), "addrs:///127.0.0.1:8020", grpc.WithInsecure(), grpc.WithUnaryInterceptor(interceptor), | ||
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name))) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return pb.NewBusinessIntClient(conn) | ||
}, | ||
} | ||
} |
Oops, something went wrong.