Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MetaProtocol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nebula
MetaProtocol
Commits
8081d42a
Commit
8081d42a
authored
Oct 14, 2022
by
xueqianLu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add makefile and go.mod.
parent
c07bc184
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
916 additions
and
0 deletions
+916
-0
Makefile
Makefile
+26
-0
go.mod
go.mod
+10
-0
go.sum
go.sum
+799
-0
main.go
main.go
+81
-0
No files found.
Makefile
0 → 100644
View file @
8081d42a
# Protobuf generated go files
PROTO_FILES
=
$(
shell
find
.
-path
-prune
-o
-type
f
-name
'*.proto'
-print
|
grep
-v
vendor
)
PROTO_GO_FILES
=
$
(
patsubst %.proto, %.pb.go,
$(PROTO_FILES)
)
PROTO_GO_FILES_REAL
=
$(
shell
find
.
-path
-prune
-o
-type
f
-name
'*.pb.go'
-print
|
grep
-v
vendor
)
DEST
=
${
PWD
}
BIN
=
protocol
.PHONY
:
all build deps clean codecheck
all
:
build codecheck
codecheck
:
$(PROTO_GO_FILES) main.go
@
go build
-o
$(BIN)
build
:
$(PROTO_GO_FILES)
# Implicit compile rule for GRPC/proto files (note since pb.go files no longer generated
# in same directory as proto file this just regenerates everything
%.pb.go
:
%.proto
protoc
-I
.
-I
protobuf
"
$<
"
--gogo_out
=
plugins
=
grpc:
${
DEST
}
deps
:
@
go get
-u
github.com/gogo/protobuf/protoc-gen-gogo
clean
:
@
rm
-f
$(PROTO_GO_FILES_REAL)
$(BIN)
go.mod
0 → 100644
View file @
8081d42a
module github.com/cmpchain/metaprotocol
go 1.15
require (
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.2
google.golang.org/genproto v0.0.0-20221013201013-33fc6f83cba4
google.golang.org/grpc v1.50.0
)
go.sum
0 → 100644
View file @
8081d42a
This diff is collapsed.
Click to expand it.
main.go
0 → 100644
View file @
8081d42a
package
main
import
(
"context"
"fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"net"
metacrypter
"github.com/cmpchain/metaprotocol/meta/crypter/v1"
metaring
"github.com/cmpchain/metaprotocol/meta/ring/v1"
metabase
"github.com/cmpchain/metaprotocol/meta/base/v1"
metap2p
"github.com/cmpchain/metaprotocol/meta/p2p/v1"
metanebula
"github.com/cmpchain/metaprotocol/meta/nebula/v1"
metasentry
"github.com/cmpchain/metaprotocol/meta/sentry/v1"
txchecker
"github.com/cmpchain/metaprotocol/meta/txchecker/v1"
)
type
P2PServer
struct
{
metap2p
.
UnimplementedP2PServiceServer
}
type
NebulaServer
struct
{
metanebula
.
UnimplementedShelfServiceServer
}
type
SentryServer
struct
{
metasentry
.
UnimplementedShelfServiceServer
}
type
TxCheckServer
struct
{
txchecker
.
UnimplementedShelfServiceServer
}
// hello server
type
BaseType
struct
{
metabase
.
UnimplementedShelfServiceServer
}
type
RingServer
struct
{
metaring
.
UnimplementedShelfServiceServer
}
type
server
struct
{
metacrypter
.
UnimplementedCrypterServiceServer
}
func
(
*
server
)
Sign
(
ctx
context
.
Context
,
req
*
metacrypter
.
SignRequest
)
(
*
metacrypter
.
SignResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Sign not implemented"
)
}
func
(
*
server
)
Verify
(
ctx
context
.
Context
,
req
*
metacrypter
.
VerifyRequest
)
(
*
metacrypter
.
VerifyResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Verify not implemented"
)
}
func
(
*
server
)
Recover
(
ctx
context
.
Context
,
req
*
metacrypter
.
RecoverRequest
)
(
*
metacrypter
.
RecoverResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method Recover not implemented"
)
}
func
(
*
server
)
BatchSign
(
ctx
context
.
Context
,
req
*
metacrypter
.
BatchSignRequest
)
(
*
metacrypter
.
BatchSignResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method BatchSign not implemented"
)
}
func
(
*
server
)
BatchVerify
(
ctx
context
.
Context
,
req
*
metacrypter
.
BatchVerifyRequest
)
(
*
metacrypter
.
BatchVerifyResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method BatchVerify not implemented"
)
}
func
(
*
server
)
BatchRecover
(
ctx
context
.
Context
,
req
*
metacrypter
.
BatchRecoverRequest
)
(
*
metacrypter
.
BatchRecoverResponse
,
error
)
{
return
nil
,
status
.
Errorf
(
codes
.
Unimplemented
,
"method BatchRecover not implemented"
)
}
func
main
()
{
// 监听本地的8972端口
lis
,
err
:=
net
.
Listen
(
"tcp"
,
":8972"
)
if
err
!=
nil
{
fmt
.
Printf
(
"failed to listen: %v"
,
err
)
return
}
s
:=
grpc
.
NewServer
()
// 创建gRPC服务器
metacrypter
.
RegisterCrypterServiceServer
(
s
,
&
server
{})
// 在gRPC服务端注册服务
// 启动服务
err
=
s
.
Serve
(
lis
)
if
err
!=
nil
{
fmt
.
Printf
(
"failed to serve: %v"
,
err
)
return
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment