diff --git a/.gitignore b/.gitignore index f1c181ec9..ac3c052de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +vendor/ +*~ +*# +.#* + +/.generated + # Binaries for programs and plugins *.exe *.exe~ diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..35dc5ddec --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +## +## functions +## + +rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) + +## +## vars +## + +GOPATH ?= $(HOME)/go +BIN = $(GOPATH)/bin/pathwar.pw +SOURCES = $(call rwildcard, ./, *.go) +PROTOS = $(call rwildcard, ./, *.proto) +GENERATED_FILES = \ + $(patsubst %.proto,%.pb.go,$(PROTOS)) \ + $(call rwildcard ./, *.gen.go) +PROTOC_OPTS = -I/protobuf:. +RUN_OPTS ?= + +## +## rules +## + +.PHONY: help +help: + @echo "Make commands:" + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: \ + '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | \ + sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | grep -v / | \ + sed 's/^/ $(HELP_MSG_PREFIX)make /' + +.PHONY: run +run: $(BIN) + $(BIN) server $(RUN_OPTS) + +.PHONY: install +install: $(BIN) +$(BIN): .generated $(SOURCES) + go install -v + +.PHONY: clean +clean: + rm -f $(GENERATED_FILES) .generated + +.PHONY: generate +generate: .generated +.generated: $(PROTOS) + rm -f $(GENERATED_FILES) + docker run \ + --user="$(shell id -u)" \ + --volume="$(PWD):/go/src/pathwar.pw" \ + --workdir="/go/src/pathwar.pw" \ + --entrypoint="sh" \ + --rm \ + moul/protoc-gen-gotemplate \ + -xec "make _generate" + touch $@ + +.PHONY: _generate +_generate: $(GENERATED_FILES) + +%.pb.go: %.proto + protoc $(PROTOC_OPTS) --gofast_out=plugins=grpc:"$(GOPATH)/src" "$(dir $<)"/*.proto diff --git a/go.mod b/go.mod index 83d23b2dc..82cd8751e 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,14 @@ module pathwar.pw require ( + github.com/golang/protobuf v1.2.0 + github.com/pkg/errors v0.8.0 github.com/spf13/cobra v0.0.3 github.com/spf13/pflag v1.0.3 github.com/spf13/viper v1.2.1 + go.uber.org/atomic v1.3.2 // indirect + go.uber.org/multierr v1.1.0 // indirect + go.uber.org/zap v1.9.1 + golang.org/x/net v0.0.0-20181114220301-adae6a3d119a + google.golang.org/grpc v1.16.0 ) diff --git a/go.sum b/go.sum index e3dc23d69..6a4152704 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,24 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I= github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg= @@ -22,10 +32,30 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.2.1 h1:bIcUwXqLseLF3BDAZduuNfekWG87ibtFxi59Bq+oI9M= github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a h1:gOpx8G595UYyvj8UK4+OFyY4rx037g3fmfhe5SasG3U= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992 h1:BH3eQWeGbwRU2+wxxuuPOdFBmaiBH81O8BugSjHeTFg= golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/main.go b/main.go index 3e58a9c77..7eeb19457 100644 --- a/main.go +++ b/main.go @@ -2,16 +2,23 @@ package main // import "pathwar.pw" import ( "fmt" + "math/rand" "os" "strings" + "time" + "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" "pathwar.pw/server" ) func main() { + rand.Seed(time.Now().UnixNano()) + rootCmd := newRootCommand() if err := rootCmd.Execute(); err != nil { _, _ = fmt.Fprintf(os.Stderr, "%v\n", err) @@ -27,7 +34,27 @@ func newRootCommand() *cobra.Command { //cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose mode") cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { - // setup logging etc + // setup logging + config := zap.NewDevelopmentConfig() + config.Level.SetLevel(zap.DebugLevel) + config.DisableStacktrace = true + config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder + l, err := config.Build() + if err != nil { + return errors.Wrap(err, "failed to configure logger") + } + zap.ReplaceGlobals(l) + zap.L().Debug("logger initialized") + + // setup viper + viper.AddConfigPath(".") + viper.SetConfigName(".pathwar") + if err := viper.MergeInConfig(); err != nil { + if _, ok := err.(viper.ConfigFileNotFoundError); !ok { + return errors.Wrap(err, "failed to apply viper config") + } + } + return nil } diff --git a/server/cobra.go b/server/cobra.go index 6bbd4ba5a..7e0b82b68 100644 --- a/server/cobra.go +++ b/server/cobra.go @@ -1,22 +1,13 @@ package server import ( - "encoding/json" - "fmt" - "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" ) -type serverOptions struct{} - -func (opts serverOptions) String() string { - out, _ := json.Marshal(opts) - return string(out) -} - func serverSetupFlags(flags *pflag.FlagSet, opts *serverOptions) { + flags.StringVar(&opts.GRPCBind, "grpc-bind", ":4444", "grpc server address") viper.BindPFlags(flags) } @@ -34,8 +25,3 @@ func NewServerCommand() *cobra.Command { serverSetupFlags(cmd.Flags(), opts) return cmd } - -func server(opts *serverOptions) error { - fmt.Println("hello world server") - return nil -} diff --git a/server/server.go b/server/server.go new file mode 100644 index 000000000..26367cae3 --- /dev/null +++ b/server/server.go @@ -0,0 +1,33 @@ +package server + +import ( + "encoding/json" + "net" + + "github.com/pkg/errors" + "go.uber.org/zap" + "google.golang.org/grpc" +) + +type serverOptions struct { + GRPCBind string +} + +func (opts serverOptions) String() string { + out, _ := json.Marshal(opts) + return string(out) +} + +func server(opts *serverOptions) error { + listener, err := net.Listen("tcp", opts.GRPCBind) + if err != nil { + return errors.Wrap(err, "failed to listen") + } + + grpcServer := grpc.NewServer() + RegisterServerServer(grpcServer, &svc{}) + + zap.L().Info("grpc server started", zap.String("bind", opts.GRPCBind)) + grpcServer.Serve(listener) + return nil +} diff --git a/server/server.pb.go b/server/server.pb.go new file mode 100644 index 000000000..5077a2e2f --- /dev/null +++ b/server/server.pb.go @@ -0,0 +1,332 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: server/server.proto + +/* +Package server is a generated protocol buffer package. + +It is generated from these files: + server/server.proto + +It has these top-level messages: + Void +*/ +package server + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Void struct { +} + +func (m *Void) Reset() { *m = Void{} } +func (m *Void) String() string { return proto.CompactTextString(m) } +func (*Void) ProtoMessage() {} +func (*Void) Descriptor() ([]byte, []int) { return fileDescriptorServer, []int{0} } + +func init() { + proto.RegisterType((*Void)(nil), "pathwar.server.Void") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for Server service + +type ServerClient interface { + Ping(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) +} + +type serverClient struct { + cc *grpc.ClientConn +} + +func NewServerClient(cc *grpc.ClientConn) ServerClient { + return &serverClient{cc} +} + +func (c *serverClient) Ping(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) { + out := new(Void) + err := grpc.Invoke(ctx, "/pathwar.server.Server/Ping", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Server service + +type ServerServer interface { + Ping(context.Context, *Void) (*Void, error) +} + +func RegisterServerServer(s *grpc.Server, srv ServerServer) { + s.RegisterService(&_Server_serviceDesc, srv) +} + +func _Server_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Void) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pathwar.server.Server/Ping", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServer).Ping(ctx, req.(*Void)) + } + return interceptor(ctx, in, info, handler) +} + +var _Server_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pathwar.server.Server", + HandlerType: (*ServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _Server_Ping_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "server/server.proto", +} + +func (m *Void) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Void) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func encodeVarintServer(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Void) Size() (n int) { + var l int + _ = l + return n +} + +func sovServer(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozServer(x uint64) (n int) { + return sovServer(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Void) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowServer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Void: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Void: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipServer(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthServer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipServer(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthServer + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowServer + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipServer(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthServer = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowServer = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("server/server.proto", fileDescriptorServer) } + +var fileDescriptorServer = []byte{ + // 121 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4e, 0x2d, 0x2a, + 0x4b, 0x2d, 0xd2, 0x87, 0x50, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x7c, 0x05, 0x89, 0x25, + 0x19, 0xe5, 0x89, 0x45, 0x7a, 0x10, 0x51, 0x25, 0x36, 0x2e, 0x96, 0xb0, 0xfc, 0xcc, 0x14, 0x23, + 0x3b, 0x2e, 0xb6, 0x60, 0xb0, 0x88, 0x90, 0x09, 0x17, 0x4b, 0x40, 0x66, 0x5e, 0xba, 0x90, 0x88, + 0x1e, 0xaa, 0x52, 0x3d, 0x90, 0x3a, 0x29, 0xac, 0xa2, 0x4a, 0x0c, 0x4e, 0xca, 0x27, 0x1e, 0xc9, + 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x82, + 0x30, 0x85, 0x05, 0xe5, 0x50, 0x27, 0x24, 0xb1, 0x81, 0xdd, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x55, 0x34, 0x50, 0xd7, 0x9a, 0x00, 0x00, 0x00, +} diff --git a/server/server.proto b/server/server.proto new file mode 100644 index 000000000..56d55415d --- /dev/null +++ b/server/server.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package pathwar.server; + +//import "gogoproto/gogo.proto"; +//import "google/protobuf/timestamp.proto"; + +option go_package = "pathwar.pw/server"; + +service Server { + rpc Ping(Void) returns (Void) {}; +} + +message Void {} \ No newline at end of file diff --git a/server/svc.go b/server/svc.go new file mode 100644 index 000000000..f690d43f0 --- /dev/null +++ b/server/svc.go @@ -0,0 +1,10 @@ +package server + +import "context" + +type svc struct { +} + +func (s *svc) Ping(_ context.Context, _ *Void) (*Void, error) { + return &Void{}, nil +}