Check in
This commit is contained in:
commit
f87c2194c8
13
README.md
Normal file
13
README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# bacheca
|
||||||
|
|
||||||
|
RSS/Atom feed generator with a simple REST API (and hopefully gRPC)
|
||||||
|
|
||||||
|
Written using go-kit and Moa but should work fine alone, given you have a good enough reverse proxy setup.
|
||||||
|
|
||||||
|
## Things to note
|
||||||
|
|
||||||
|
### Regenerate protobuf file
|
||||||
|
|
||||||
|
```sh
|
||||||
|
protoc --go_out=plugins=grpc:. bacheca.proto
|
||||||
|
```
|
60
cmd/bacheca-moa/main.go
Normal file
60
cmd/bacheca-moa/main.go
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"git.fromouter.space/Artificiale/moa/sd"
|
||||||
|
|
||||||
|
"github.com/go-kit/kit/log"
|
||||||
|
|
||||||
|
svc "git.abbiamoundominio.org/hamcha/bacheca"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
httpPort := flag.Int("http.port", 8080, "HTTP listen port")
|
||||||
|
consulAddr := flag.String("consul.addr", "consul:8500", "Consul address")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var logger log.Logger
|
||||||
|
{
|
||||||
|
logger = log.NewLogfmtLogger(os.Stderr)
|
||||||
|
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||||
|
logger = log.With(logger, "caller", log.DefaultCaller)
|
||||||
|
}
|
||||||
|
|
||||||
|
s := svc.MakeService()
|
||||||
|
handler := svc.MakeHTTPHandler(s, logger)
|
||||||
|
|
||||||
|
// Register with consul
|
||||||
|
registrar := sd.Register(*consulAddr, sd.Options{
|
||||||
|
Name: "bacheca",
|
||||||
|
Advertise: fmt.Sprintf("bacheca:%d", *httpPort),
|
||||||
|
Tags: []string{
|
||||||
|
"http", // Expose via HTTP
|
||||||
|
"match-path:events", // Publish at /events/*
|
||||||
|
"private", // All APIs are private..
|
||||||
|
"public:/feed", // ..except /feed
|
||||||
|
},
|
||||||
|
}, logger)
|
||||||
|
defer registrar.Deregister()
|
||||||
|
|
||||||
|
errs := make(chan error)
|
||||||
|
go func() {
|
||||||
|
c := make(chan os.Signal)
|
||||||
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
errs <- fmt.Errorf("%s", <-c)
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
bind := fmt.Sprintf(":%d", *httpPort)
|
||||||
|
logger.Log("transport", "HTTP", "addr", bind)
|
||||||
|
errs <- http.ListenAndServe(bind, handler)
|
||||||
|
}()
|
||||||
|
|
||||||
|
logger.Log("exit", <-errs)
|
||||||
|
}
|
46
cmd/bacheca-server/main.go
Normal file
46
cmd/bacheca-server/main.go
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/go-kit/kit/log"
|
||||||
|
|
||||||
|
svc "git.abbiamoundominio.org/hamcha/bacheca"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
httpPort := flag.Int("http.port", 8080, "HTTP listen port")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var logger log.Logger
|
||||||
|
{
|
||||||
|
logger = log.NewLogfmtLogger(os.Stderr)
|
||||||
|
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||||
|
logger = log.With(logger, "caller", log.DefaultCaller)
|
||||||
|
}
|
||||||
|
|
||||||
|
s := svc.MakeService()
|
||||||
|
handler := svc.MakeHTTPHandler(s, logger)
|
||||||
|
|
||||||
|
//TODO Add auth middleware
|
||||||
|
|
||||||
|
errs := make(chan error)
|
||||||
|
go func() {
|
||||||
|
c := make(chan os.Signal)
|
||||||
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
errs <- fmt.Errorf("%s", <-c)
|
||||||
|
}()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
bind := fmt.Sprintf(":%d", *httpPort)
|
||||||
|
logger.Log("transport", "HTTP", "addr", bind)
|
||||||
|
errs <- http.ListenAndServe(bind, handler)
|
||||||
|
}()
|
||||||
|
|
||||||
|
logger.Log("exit", <-errs)
|
||||||
|
}
|
46
cmd/bacheca-static/main.go
Normal file
46
cmd/bacheca-static/main.go
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
proto "git.abbiamoundominio.org/hamcha/bacheca/proto"
|
||||||
|
|
||||||
|
"github.com/go-kit/kit/log"
|
||||||
|
|
||||||
|
svc "git.abbiamoundominio.org/hamcha/bacheca"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
format := flag.String("fmt", "rss", "Feed format (rss, atom, json)")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
ftype := strings.ToUpper(*format)
|
||||||
|
fid, ok := proto.GetFeedRequest_FeedType_value[ftype]
|
||||||
|
if !ok {
|
||||||
|
panic("invalid format (-fmt), check help for supported formats")
|
||||||
|
}
|
||||||
|
|
||||||
|
var logger log.Logger
|
||||||
|
{
|
||||||
|
logger = log.NewLogfmtLogger(os.Stderr)
|
||||||
|
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||||
|
logger = log.With(logger, "caller", log.DefaultCaller)
|
||||||
|
}
|
||||||
|
|
||||||
|
s := svc.MakeService()
|
||||||
|
|
||||||
|
req := &proto.GetFeedRequest{
|
||||||
|
FeedType: proto.GetFeedRequest_FeedType(fid),
|
||||||
|
}
|
||||||
|
rsp := &proto.GetFeedResponse{}
|
||||||
|
err := s.GetFeed(context.Background(), req, rsp)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Print(rsp.Data)
|
||||||
|
}
|
17
endpoints.go
Normal file
17
endpoints.go
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package bacheca
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
proto "git.abbiamoundominio.org/hamcha/bacheca/proto"
|
||||||
|
"github.com/go-kit/kit/endpoint"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getFeedEndpoint(svc Service) endpoint.Endpoint {
|
||||||
|
return func(ctx context.Context, request interface{}) (interface{}, error) {
|
||||||
|
req := request.(proto.GetFeedRequest)
|
||||||
|
rsp := proto.GetFeedResponse{}
|
||||||
|
err := svc.GetFeed(ctx, &req, &rsp)
|
||||||
|
return rsp, err
|
||||||
|
}
|
||||||
|
}
|
12
go.mod
Normal file
12
go.mod
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module git.abbiamoundominio.org/hamcha/bacheca
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.5 // indirect
|
||||||
|
github.com/go-kit/kit v0.8.0
|
||||||
|
github.com/golang/protobuf v1.3.2
|
||||||
|
github.com/gorilla/mux v1.7.2
|
||||||
|
google.golang.org/grpc v1.22.0
|
||||||
|
)
|
180
go.sum
Normal file
180
go.sum
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1-p2/go.mod h1:dHYul6vVMwDCzre18AFs6NmI22yeI7AE0iQC1jFEQi0=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1 h1:1mVML0v3Bh5Fya9dz7pKtlt7+Z6hRzXxmlY7sBvw0FI=
|
||||||
|
git.fromouter.space/Artificiale/moa v0.0.1/go.mod h1:dHYul6vVMwDCzre18AFs6NmI22yeI7AE0iQC1jFEQi0=
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.5 h1:aUTE1svuXK6osE7XsaVBOkr3Hl05gP8JrlXkx69QFBY=
|
||||||
|
git.fromouter.space/mcg/cardgage v0.0.5/go.mod h1:vCmJ9HRdRGSWg2YQW9oNG7geYACdgWYmzL+zZdrsYhQ=
|
||||||
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||||
|
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM=
|
||||||
|
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
|
||||||
|
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||||
|
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||||
|
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||||
|
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||||
|
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||||
|
github.com/cenkalti/backoff v2.0.0+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||||
|
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||||
|
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||||
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||||
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
|
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
|
||||||
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
|
||||||
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
|
github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4=
|
||||||
|
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
||||||
|
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||||
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
|
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
|
||||||
|
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||||
|
github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA=
|
||||||
|
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||||
|
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||||
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
|
||||||
|
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc=
|
||||||
|
github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||||
|
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||||
|
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI=
|
||||||
|
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||||
|
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||||
|
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||||
|
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||||
|
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||||
|
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
|
github.com/hashicorp/memberlist v0.1.4/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||||
|
github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0=
|
||||||
|
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||||
|
github.com/hashicorp/serf v0.8.3 h1:MWYcmct5EtKz0efYooPcL0yNkem+7kWxqXDi/UIh+8k=
|
||||||
|
github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k=
|
||||||
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
|
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/miekg/dns v1.1.13/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
|
github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2BA=
|
||||||
|
github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc=
|
||||||
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
|
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
|
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
|
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||||
|
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||||
|
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
|
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
|
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||||
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||||
|
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||||
|
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||||
|
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||||
|
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
|
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||||
|
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||||
|
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||||
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||||
|
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
|
||||||
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
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/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180828065106-d99a578cf41b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190531132440-69e3a3a65b5b h1:cuzzKXORsbIjh3IeOgOj0x2QA08ntIxmwi1mkRC3qoc=
|
||||||
|
golang.org/x/sys v0.0.0-20190531132440-69e3a3a65b5b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
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-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||||
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
|
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.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
|
google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=
|
||||||
|
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/fatih/pool.v2 v2.0.0/go.mod h1:8xVGeu1/2jr2wm5V9SPuMht2H5AEmf5aFMGSQixtjTY=
|
||||||
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
gopkg.in/rethinkdb/rethinkdb-go.v5 v5.0.1/go.mod h1:x+1XKi70FH0kHCpvPQ78hGBCCxoNdE7sP+kEFdKgN6A=
|
||||||
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||||
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
235
proto/bacheca.pb.go
Normal file
235
proto/bacheca.pb.go
Normal file
|
@ -0,0 +1,235 @@
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: bacheca.proto
|
||||||
|
|
||||||
|
package bacheca
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||||
|
|
||||||
|
type GetFeedRequest_FeedType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
GetFeedRequest_RSS GetFeedRequest_FeedType = 0
|
||||||
|
GetFeedRequest_ATOM GetFeedRequest_FeedType = 1
|
||||||
|
GetFeedRequest_JSON GetFeedRequest_FeedType = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
var GetFeedRequest_FeedType_name = map[int32]string{
|
||||||
|
0: "RSS",
|
||||||
|
1: "ATOM",
|
||||||
|
2: "JSON",
|
||||||
|
}
|
||||||
|
|
||||||
|
var GetFeedRequest_FeedType_value = map[string]int32{
|
||||||
|
"RSS": 0,
|
||||||
|
"ATOM": 1,
|
||||||
|
"JSON": 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x GetFeedRequest_FeedType) String() string {
|
||||||
|
return proto.EnumName(GetFeedRequest_FeedType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (GetFeedRequest_FeedType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_fb1fda27af5c282e, []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetFeedRequest struct {
|
||||||
|
FeedType GetFeedRequest_FeedType `protobuf:"varint,1,opt,name=feedType,proto3,enum=GetFeedRequest_FeedType" json:"feedType,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetFeedRequest) Reset() { *m = GetFeedRequest{} }
|
||||||
|
func (m *GetFeedRequest) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetFeedRequest) ProtoMessage() {}
|
||||||
|
func (*GetFeedRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_fb1fda27af5c282e, []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetFeedRequest) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetFeedRequest.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetFeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetFeedRequest.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *GetFeedRequest) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetFeedRequest.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *GetFeedRequest) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetFeedRequest.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetFeedRequest) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetFeedRequest.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetFeedRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetFeedRequest) GetFeedType() GetFeedRequest_FeedType {
|
||||||
|
if m != nil {
|
||||||
|
return m.FeedType
|
||||||
|
}
|
||||||
|
return GetFeedRequest_RSS
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetFeedResponse struct {
|
||||||
|
Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetFeedResponse) Reset() { *m = GetFeedResponse{} }
|
||||||
|
func (m *GetFeedResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*GetFeedResponse) ProtoMessage() {}
|
||||||
|
func (*GetFeedResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_fb1fda27af5c282e, []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *GetFeedResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_GetFeedResponse.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *GetFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_GetFeedResponse.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *GetFeedResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_GetFeedResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *GetFeedResponse) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_GetFeedResponse.Size(m)
|
||||||
|
}
|
||||||
|
func (m *GetFeedResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_GetFeedResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_GetFeedResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *GetFeedResponse) GetData() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Data
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
proto.RegisterEnum("GetFeedRequest_FeedType", GetFeedRequest_FeedType_name, GetFeedRequest_FeedType_value)
|
||||||
|
proto.RegisterType((*GetFeedRequest)(nil), "GetFeedRequest")
|
||||||
|
proto.RegisterType((*GetFeedResponse)(nil), "GetFeedResponse")
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { proto.RegisterFile("bacheca.proto", fileDescriptor_fb1fda27af5c282e) }
|
||||||
|
|
||||||
|
var fileDescriptor_fb1fda27af5c282e = []byte{
|
||||||
|
// 178 bytes of a gzipped FileDescriptorProto
|
||||||
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4d, 0x4a, 0x4c, 0xce,
|
||||||
|
0x48, 0x4d, 0x4e, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0xca, 0xe7, 0xe2, 0x73, 0x4f, 0x2d,
|
||||||
|
0x71, 0x4b, 0x4d, 0x4d, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x32, 0xe1, 0xe2, 0x48,
|
||||||
|
0x4b, 0x4d, 0x4d, 0x09, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x33, 0x92, 0xd0,
|
||||||
|
0x43, 0x55, 0xa2, 0xe7, 0x06, 0x95, 0x0f, 0x82, 0xab, 0x54, 0x52, 0xe7, 0xe2, 0x80, 0x89, 0x0a,
|
||||||
|
0xb1, 0x73, 0x31, 0x07, 0x05, 0x07, 0x0b, 0x30, 0x08, 0x71, 0x70, 0xb1, 0x38, 0x86, 0xf8, 0xfb,
|
||||||
|
0x0a, 0x30, 0x82, 0x58, 0x5e, 0xc1, 0xfe, 0x7e, 0x02, 0x4c, 0x4a, 0xaa, 0x5c, 0xfc, 0x70, 0xd3,
|
||||||
|
0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x84, 0xb8, 0x58, 0x52, 0x12, 0x4b, 0x12, 0xc1, 0xb6,
|
||||||
|
0x71, 0x06, 0x81, 0xd9, 0x46, 0xe6, 0x5c, 0xac, 0x3e, 0xf9, 0x49, 0x49, 0x95, 0x42, 0x7a, 0x5c,
|
||||||
|
0xec, 0x50, 0xf5, 0x42, 0xfc, 0x68, 0xee, 0x90, 0x12, 0xd0, 0x43, 0x33, 0x4a, 0x89, 0x21, 0x89,
|
||||||
|
0x0d, 0xec, 0x2f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x00, 0x13, 0xe2, 0xe8, 0x00,
|
||||||
|
0x00, 0x00,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// LobbyClient is the client API for Lobby service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||||
|
type LobbyClient interface {
|
||||||
|
GetFeed(ctx context.Context, in *GetFeedRequest, opts ...grpc.CallOption) (*GetFeedResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type lobbyClient struct {
|
||||||
|
cc *grpc.ClientConn
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLobbyClient(cc *grpc.ClientConn) LobbyClient {
|
||||||
|
return &lobbyClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *lobbyClient) GetFeed(ctx context.Context, in *GetFeedRequest, opts ...grpc.CallOption) (*GetFeedResponse, error) {
|
||||||
|
out := new(GetFeedResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Lobby/GetFeed", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// LobbyServer is the server API for Lobby service.
|
||||||
|
type LobbyServer interface {
|
||||||
|
GetFeed(context.Context, *GetFeedRequest) (*GetFeedResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedLobbyServer can be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedLobbyServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UnimplementedLobbyServer) GetFeed(ctx context.Context, req *GetFeedRequest) (*GetFeedResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetFeed not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterLobbyServer(s *grpc.Server, srv LobbyServer) {
|
||||||
|
s.RegisterService(&_Lobby_serviceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Lobby_GetFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetFeedRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(LobbyServer).GetFeed(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Lobby/GetFeed",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(LobbyServer).GetFeed(ctx, req.(*GetFeedRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _Lobby_serviceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "Lobby",
|
||||||
|
HandlerType: (*LobbyServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetFeed",
|
||||||
|
Handler: _Lobby_GetFeed_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "bacheca.proto",
|
||||||
|
}
|
18
proto/bacheca.proto
Normal file
18
proto/bacheca.proto
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
service Lobby {
|
||||||
|
rpc GetFeed(GetFeedRequest) returns (GetFeedResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetFeedRequest {
|
||||||
|
enum FeedType {
|
||||||
|
RSS = 0;
|
||||||
|
ATOM = 1;
|
||||||
|
JSON = 2;
|
||||||
|
}
|
||||||
|
FeedType feedType = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetFeedResponse {
|
||||||
|
string data = 1;
|
||||||
|
}
|
24
service.go
Normal file
24
service.go
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package bacheca
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
proto "git.abbiamoundominio.org/hamcha/bacheca/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Service is the definition of the Bacheca service
|
||||||
|
type Service interface {
|
||||||
|
GetFeed(context.Context, *proto.GetFeedRequest, *proto.GetFeedResponse) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type bachecaService struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func MakeService() Service {
|
||||||
|
return &bachecaService{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *bachecaService) GetFeed(ctx context.Context, req *proto.GetFeedRequest, rsp *proto.GetFeedResponse) error {
|
||||||
|
return errors.New("not implemented")
|
||||||
|
}
|
79
transport.go
Normal file
79
transport.go
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package bacheca
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
proto "git.abbiamoundominio.org/hamcha/bacheca/proto"
|
||||||
|
"git.fromouter.space/Artificiale/moa/sd"
|
||||||
|
"github.com/go-kit/kit/log"
|
||||||
|
httptransport "github.com/go-kit/kit/transport/http"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Request errors
|
||||||
|
var (
|
||||||
|
ErrInvalidFormat = errors.New("invalid format (use 'rss', 'atom', 'json')")
|
||||||
|
)
|
||||||
|
|
||||||
|
// MakeHTTPHandler makes the service available via HTTP
|
||||||
|
func MakeHTTPHandler(svc Service, logger log.Logger) http.Handler {
|
||||||
|
r := mux.NewRouter()
|
||||||
|
options := []httptransport.ServerOption{
|
||||||
|
httptransport.ServerErrorLogger(logger),
|
||||||
|
httptransport.ServerErrorEncoder(encodeError),
|
||||||
|
}
|
||||||
|
|
||||||
|
r.Methods("GET").Path("/feed").Handler(httptransport.NewServer(
|
||||||
|
getFeedEndpoint(svc),
|
||||||
|
decodeFeedRequest,
|
||||||
|
encodeFeedResponse,
|
||||||
|
options...,
|
||||||
|
))
|
||||||
|
|
||||||
|
sd.RegisterHealthHandler(r)
|
||||||
|
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeFeedRequest(_ context.Context, r *http.Request) (interface{}, error) {
|
||||||
|
url := r.URL.Query()
|
||||||
|
request := proto.GetFeedRequest{
|
||||||
|
FeedType: proto.GetFeedRequest_RSS,
|
||||||
|
}
|
||||||
|
if typ := url.Get("type"); typ != "" {
|
||||||
|
ftype := strings.ToUpper(typ)
|
||||||
|
fid, ok := proto.GetFeedRequest_FeedType_value[ftype]
|
||||||
|
if !ok {
|
||||||
|
return nil, ErrInvalidFormat
|
||||||
|
}
|
||||||
|
request.FeedType = proto.GetFeedRequest_FeedType(fid)
|
||||||
|
}
|
||||||
|
return request, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeFeedResponse(_ context.Context, w http.ResponseWriter, response interface{}) error {
|
||||||
|
resp := response.(proto.GetFeedResponse)
|
||||||
|
_, err := fmt.Fprint(w, resp.Data)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeError(_ context.Context, err error, w http.ResponseWriter) {
|
||||||
|
if err == nil {
|
||||||
|
panic("encodeError with nil error")
|
||||||
|
}
|
||||||
|
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
w.WriteHeader(codeFrom(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
func codeFrom(err error) int {
|
||||||
|
switch err {
|
||||||
|
case ErrInvalidFormat:
|
||||||
|
return http.StatusBadRequest
|
||||||
|
default:
|
||||||
|
return http.StatusInternalServerError
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user