Compare commits
62 Commits
pleroma-re
...
master
Author | SHA1 | Date |
---|---|---|
Derek | db05f44aaa | |
Naoki Kosaka | 353bd97481 | |
Naoki Kosaka | f69286556e | |
Naoki Kosaka | 3436376bbf | |
Naoki Kosaka | b91c39164e | |
Naoki Kosaka | 07a0cb179a | |
Naoki Kosaka | 5269681c26 | |
Naoki Kosaka | 74c7587870 | |
Naoki Kosaka | 869f0fde9a | |
Naoki Kosaka | 1c9446493d | |
Naoki Kosaka | f95d9e1340 | |
Naoki Kosaka | 7c33331c40 | |
Naoki Kosaka | 56bf2f093e | |
Naoki Kosaka | 7242e75647 | |
Naoki Kosaka | 4a9f05626b | |
Naoki Kosaka | 846b600d95 | |
Naoki Kosaka | 1260985b75 | |
Naoki Kosaka | f05921420f | |
Naoki Kosaka | 4dd69d0dac | |
Naoki Kosaka | 3d92d8306a | |
Naoki Kosaka | a1f3270c74 | |
Naoki Kosaka | d169fa091e | |
Naoki Kosaka | 9297540a1d | |
Naoki Kosaka | 2ef9029bf0 | |
Naoki Kosaka | 0f59a6e5a1 | |
Naoki Kosaka | 8ce0e5ded5 | |
Naoki Kosaka | d67240be36 | |
Naoki Kosaka | aafac21664 | |
Naoki Kosaka | 99f870e0f2 | |
Naoki Kosaka | 73a1f2231c | |
Naoki Kosaka | 7894e78c3f | |
Naoki Kosaka | 638a1e7319 | |
Naoki Kosaka | a2cc2b7781 | |
Naoki Kosaka | d04882d163 | |
Naoki Kosaka | c356e47986 | |
Naoki Kosaka | dda20f9aec | |
Naoki Kosaka | 13c5d73b8e | |
Naoki Kosaka | 0f5e4d46ce | |
Shlee | 67251952a2 | |
Naoki Kosaka | a4c58124dd | |
Naoki Kosaka | 81581db527 | |
Naoki Kosaka | d1cc70657e | |
Naoki Kosaka | 4a3594096b | |
Naoki Kosaka | 66f5b5bb53 | |
Naoki Kosaka | f90b6a85c0 | |
Naoki Kosaka | 91e147ac0d | |
Naoki Kosaka | 7e51cd7190 | |
Naoki Kosaka | 9f439a0629 | |
Naoki Kosaka | 1cdc820d6d | |
Naoki Kosaka | 9d9640ea03 | |
Naoki Kosaka | 53700cd8f9 | |
Naoki Kosaka | 1acf43ab05 | |
Naoki Kosaka | 49f1469f8e | |
Naoki Kosaka | 82d8b1250e | |
Naoki Kosaka | 01d8bd1087 | |
Naoki Kosaka | d307b0968f | |
Naoki Kosaka | 1f971cb91b | |
Naoki Kosaka | 72d3c82867 | |
Naoki Kosaka | 02683a8f54 | |
Naoki Kosaka | 60a9fe0d41 | |
Naoki Kosaka | 8084db6403 | |
Naoki Kosaka | 17394e7e40 |
|
@ -1,44 +0,0 @@
|
|||
version: 2
|
||||
jobs:
|
||||
test:
|
||||
docker:
|
||||
- image: circleci/golang
|
||||
environment:
|
||||
REDIS_URL: redis://localhost:6379/0
|
||||
- image: redis:alpine
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: build
|
||||
command: |
|
||||
go version
|
||||
go test -coverprofile=coverage.txt -covermode=atomic -p 1 . ./worker ./cli ./State
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
docker:
|
||||
docker:
|
||||
- image: docker:git
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker
|
||||
- run:
|
||||
name: build docker image
|
||||
command: |
|
||||
docker build -t ${DOCKER_USER}/activity-relay:edge .
|
||||
- run:
|
||||
name: upload image to docker hub.
|
||||
command: |
|
||||
docker login --username=${DOCKER_USER} --password=${DOCKER_PASS}
|
||||
docker push ${DOCKER_USER}/activity-relay:edge
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- test
|
||||
- docker:
|
||||
requires:
|
||||
- test
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
|
@ -0,0 +1,26 @@
|
|||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Build Docker Images
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
docker build -t activity-relay:$(echo ${GITHUB_SHA}|head -c7) .
|
||||
- name: Push Docker Images to DockerHub
|
||||
run: |
|
||||
docker login -u ${{ secrets.REGISTORY_USER }} -p ${{ secrets.REGISTORY_PASS }}
|
||||
docker tag activity-relay:$(echo ${GITHUB_SHA}|head -c7) ${{ secrets.REGISTORY_USER }}/activity-relay:$(echo ${GITHUB_SHA}|head -c7)
|
||||
docker push ${{ secrets.REGISTORY_USER }}/activity-relay:$(echo ${GITHUB_SHA}|head -c7)
|
||||
- name: Push Docker Images to GitHub Packages
|
||||
run: |
|
||||
docker login docker.pkg.github.com -u ${{ secrets.REGISTORY_USER }} -p ${{ secrets.GITHUB_TOKEN }}
|
||||
docker tag activity-relay:$(echo ${GITHUB_SHA}|head -c7) docker.pkg.github.com/${{ secrets.REGISTORY_USER }}/activity-relay/activity-relay:$(echo ${GITHUB_SHA}|head -c7)
|
||||
docker push docker.pkg.github.com/${{ secrets.REGISTORY_USER }}/activity-relay/activity-relay:$(echo ${GITHUB_SHA}|head -c7)
|
|
@ -0,0 +1,32 @@
|
|||
name: Release Build
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Relase Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Build Docker Images
|
||||
env:
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
docker build -t activity-relay:${GITHUB_REF#refs/tags/} .
|
||||
- name: Push Docker Images to DockerHub
|
||||
env:
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
run: |
|
||||
docker login -u ${{ secrets.REGISTORY_USER }} -p ${{ secrets.REGISTORY_PASS }}
|
||||
docker tag activity-relay:${GITHUB_REF#refs/tags/} ${{ secrets.REGISTORY_USER }}/activity-relay:${GITHUB_REF#refs/tags/}
|
||||
docker push ${{ secrets.REGISTORY_USER }}/activity-relay:${GITHUB_REF#refs/tags/}
|
||||
- name: Push Docker Images to GitHub Packages
|
||||
env:
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
run: |
|
||||
docker login docker.pkg.github.com -u ${{ secrets.REGISTORY_USER }} -p ${{ secrets.GITHUB_TOKEN }}
|
||||
docker tag activity-relay:${GITHUB_REF#refs/tags/} docker.pkg.github.com/${{ secrets.REGISTORY_USER }}/activity-relay/activity-relay:${GITHUB_REF#refs/tags/}
|
||||
docker push docker.pkg.github.com/${{ secrets.REGISTORY_USER }}/activity-relay/activity-relay:${GITHUB_REF#refs/tags/}
|
|
@ -0,0 +1,25 @@
|
|||
name: Test
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
- name: Execute test and upload coverage
|
||||
run: |
|
||||
go version
|
||||
go test -coverprofile=coverage.txt -covermode=atomic -p 1 ./api ./deliver ./control ./models
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
REDIS_URL: redis://localhost:${{ job.services.redis.ports['6379'] }}
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
# Created by https://www.gitignore.io/api/go,visualstudiocode
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/go,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=go,visualstudiocode
|
||||
|
||||
### Go ###
|
||||
# Binaries for programs and plugins
|
||||
|
@ -9,12 +10,15 @@
|
|||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
### Go Patch ###
|
||||
/vendor/
|
||||
/Godeps/
|
||||
|
@ -25,6 +29,11 @@
|
|||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.gitignore.io/api/go,visualstudiocode
|
||||
# End of https://www.toptal.com/developers/gitignore/api/go,visualstudiocode
|
|
@ -1,16 +1,14 @@
|
|||
FROM golang:alpine AS build
|
||||
FROM golang:1.19-alpine AS build
|
||||
|
||||
WORKDIR /Activity-Relay
|
||||
COPY . /Activity-Relay
|
||||
|
||||
RUN mkdir -p /rootfs/usr/bin && \
|
||||
apk add -U --no-cache git && \
|
||||
go build -o /rootfs/usr/bin/server -ldflags "-X main.version=$(git describe --tags HEAD)" . && \
|
||||
go build -o /rootfs/usr/bin/worker -ldflags "-X main.version=$(git describe --tags HEAD)" ./worker && \
|
||||
go build -o /rootfs/usr/bin/ar-cli -ldflags "-X main.version=$(git describe --tags HEAD)" ./cli
|
||||
go build -o /rootfs/usr/bin/relay -ldflags "-X main.version=$(git describe --tags HEAD)" .
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=build /rootfs/usr/bin /usr/bin
|
||||
RUN chmod +x /usr/bin/server /usr/bin/worker /usr/bin/ar-cli && \
|
||||
RUN chmod +x /usr/bin/relay && \
|
||||
apk add -U --no-cache ca-certificates
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package keyloader
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ReadPrivateKeyRSAfromPath(path string) (*rsa.PrivateKey, error) {
|
||||
file, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
decoded, _ := pem.Decode(file)
|
||||
priv, err := x509.ParsePKCS1PrivateKey(decoded.Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return priv, nil
|
||||
}
|
||||
|
||||
func ReadPublicKeyRSAfromString(pemString string) (*rsa.PublicKey, error) {
|
||||
pemByte := []byte(pemString)
|
||||
decoded, _ := pem.Decode(pemByte)
|
||||
keyInterface, err := x509.ParsePKIXPublicKey(decoded.Bytes)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return nil, err
|
||||
}
|
||||
pub := keyInterface.(*rsa.PublicKey)
|
||||
return pub, nil
|
||||
}
|
||||
|
||||
func GeneratePublicKeyPEMString(publicKey *rsa.PublicKey) string {
|
||||
publicKeyByte := x509.MarshalPKCS1PublicKey(publicKey)
|
||||
publicKeyPem := pem.EncodeToMemory(
|
||||
&pem.Block{
|
||||
Type: "RSA PUBLIC KEY",
|
||||
Bytes: publicKeyByte,
|
||||
},
|
||||
)
|
||||
return string(publicKeyPem)
|
||||
}
|
|
@ -1,199 +0,0 @@
|
|||
package state
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var redisClient *redis.Client
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath(".")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
fmt.Println("Config file is not exists. Use environment variables.")
|
||||
viper.BindEnv("redis_url")
|
||||
}
|
||||
redisOption, err := redis.ParseURL(viper.GetString("redis_url"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
redisClient = redis.NewClient(redisOption)
|
||||
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestInitialLoad(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
if testState.RelayConfig.BlockService != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
if testState.RelayConfig.CreateAsAnnounce != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
if testState.RelayConfig.ManuallyAccept != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestAddLimited(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
testState.SetLimitedDomain("example.com", true)
|
||||
|
||||
valid := false
|
||||
for _, domain := range testState.LimitedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
testState.SetLimitedDomain("example.com", false)
|
||||
|
||||
for _, domain := range testState.LimitedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestAddBlocked(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
testState.SetBlockedDomain("example.com", true)
|
||||
|
||||
valid := false
|
||||
for _, domain := range testState.BlockedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
testState.SetBlockedDomain("example.com", false)
|
||||
|
||||
for _, domain := range testState.BlockedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestAddSubscription(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
testState.AddSubscription(Subscription{
|
||||
Domain: "example.com",
|
||||
InboxURL: "https://example.com/inbox",
|
||||
})
|
||||
|
||||
valid := false
|
||||
for _, domain := range testState.Subscriptions {
|
||||
if domain.Domain == "example.com" && domain.InboxURL == "https://example.com/inbox" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
testState.DelSubscription("example.com")
|
||||
|
||||
for _, domain := range testState.Subscriptions {
|
||||
if domain.Domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestLoadCompatiSubscription(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
testState.AddSubscription(Subscription{
|
||||
Domain: "example.com",
|
||||
InboxURL: "https://example.com/inbox",
|
||||
})
|
||||
|
||||
testState.RedisClient.HDel("relay:subscription:example.com", "activity_id", "actor_id")
|
||||
testState.Load()
|
||||
|
||||
valid := false
|
||||
for _, domain := range testState.Subscriptions {
|
||||
if domain.Domain == "example.com" && domain.InboxURL == "https://example.com/inbox" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed load compati config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestSetConfig(t *testing.T) {
|
||||
redisClient.FlushAll().Result()
|
||||
testState := NewState(redisClient)
|
||||
|
||||
testState.SetConfig(BlockService, true)
|
||||
if testState.RelayConfig.BlockService != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
testState.SetConfig(CreateAsAnnounce, true)
|
||||
if testState.RelayConfig.CreateAsAnnounce != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
testState.SetConfig(ManuallyAccept, true)
|
||||
if testState.RelayConfig.ManuallyAccept != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
|
||||
testState.SetConfig(BlockService, false)
|
||||
if testState.RelayConfig.BlockService != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
testState.SetConfig(CreateAsAnnounce, false)
|
||||
if testState.RelayConfig.CreateAsAnnounce != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
testState.SetConfig(ManuallyAccept, false)
|
||||
if testState.RelayConfig.ManuallyAccept != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
globalConfig *models.RelayConfig
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor models.Actor
|
||||
|
||||
// WebfingerResource : Relay's Webfinger resource
|
||||
WebfingerResource models.WebfingerResource
|
||||
|
||||
// Nodeinfo : Relay's Nodeinfo
|
||||
Nodeinfo models.NodeinfoResources
|
||||
|
||||
relayState models.RelayState
|
||||
machineryServer *machinery.Server
|
||||
actorCache *cache.Cache
|
||||
)
|
||||
|
||||
func Entrypoint(g *models.RelayConfig, v string) error {
|
||||
var err error
|
||||
globalConfig = g
|
||||
version = v
|
||||
|
||||
err = initialize(globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
registResourceHandlers()
|
||||
|
||||
logrus.Info("Staring API Server at ", globalConfig.ServerBind())
|
||||
err = http.ListenAndServe(globalConfig.ServerBind(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func initialize(globalConfig *models.RelayConfig) error {
|
||||
var err error
|
||||
|
||||
redisClient := globalConfig.RedisClient()
|
||||
relayState = models.NewState(redisClient, true)
|
||||
relayState.ListenNotify(nil)
|
||||
|
||||
machineryServer, err = models.NewMachineryServer(globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Actor = models.NewActivityPubActorFromSelfKey(globalConfig)
|
||||
actorCache = cache.New(5*time.Minute, 10*time.Minute)
|
||||
|
||||
WebfingerResource.GenerateFromActor(globalConfig.ServerHostname(), &Actor)
|
||||
Nodeinfo.GenerateFromActor(globalConfig.ServerHostname(), &Actor, version)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func registResourceHandlers() {
|
||||
http.HandleFunc("/.well-known/nodeinfo", handleNodeinfoLink)
|
||||
http.HandleFunc("/.well-known/webfinger", handleWebfinger)
|
||||
http.HandleFunc("/nodeinfo/2.1", handleNodeinfo)
|
||||
http.HandleFunc("/actor", handleActor)
|
||||
http.HandleFunc("/inbox", func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
})
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
testConfigPath := "../misc/test/config.yml"
|
||||
file, _ := os.Open(testConfigPath)
|
||||
defer file.Close()
|
||||
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
viper.Set("ACTOR_PEM", "../misc/test/testKey.pem")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
|
||||
globalConfig, err = models.NewRelayConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = initialize(globalConfig)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
relayState = models.NewState(relayState.RedisClient, false)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-fed/httpsig"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func decodeActivity(request *http.Request) (*models.Activity, *models.Actor, []byte, error) {
|
||||
request.Header.Set("Host", request.Host)
|
||||
dataLen, _ := strconv.Atoi(request.Header.Get("Content-Length"))
|
||||
body := make([]byte, dataLen)
|
||||
request.Body.Read(body)
|
||||
|
||||
// Verify HTTPSignature
|
||||
verifier, err := httpsig.NewVerifier(request)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
KeyID := verifier.KeyId()
|
||||
keyOwnerActor := new(models.Actor)
|
||||
err = keyOwnerActor.RetrieveRemoteActor(KeyID, fmt.Sprintf("%s (golang net/http; Activity-Relay %s; %s)", globalConfig.ServerServiceName(), version, globalConfig.ServerHostname().Host), actorCache)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
PubKey, err := models.ReadPublicKeyRSAFromString(keyOwnerActor.PublicKey.PublicKeyPem)
|
||||
if PubKey == nil {
|
||||
return nil, nil, nil, errors.New("Failed parse PublicKey from string")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
err = verifier.Verify(PubKey, httpsig.RSA_SHA256)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// Verify Digest
|
||||
givenDigest := request.Header.Get("Digest")
|
||||
hash := sha256.New()
|
||||
hash.Write(body)
|
||||
b := hash.Sum(nil)
|
||||
calculatedDigest := "SHA-256=" + base64.StdEncoding.EncodeToString(b)
|
||||
|
||||
if givenDigest != calculatedDigest {
|
||||
return nil, nil, nil, errors.New("Digest header is mismatch")
|
||||
}
|
||||
|
||||
// Parse Activity
|
||||
var activity models.Activity
|
||||
err = json.Unmarshal(body, &activity)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
var remoteActor models.Actor
|
||||
err = remoteActor.RetrieveRemoteActor(activity.Actor, fmt.Sprintf("%s (golang net/http; Activity-Relay %s; %s)", globalConfig.ServerServiceName(), version, globalConfig.ServerHostname().Host), actorCache)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
return &activity, &remoteActor, body, nil
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func TestDecodeActivity(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
length := strconv.Itoa(len(body))
|
||||
req, _ := http.NewRequest("POST", "/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Add("content-length", length)
|
||||
req.Header.Add("content-type", "application/activity+json")
|
||||
req.Header.Add("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Add("digest", "SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=")
|
||||
req.Header.Add("signature", `keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
|
||||
activity, actor, _, err := decodeActivity(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
|
||||
if activity.Actor != actor.ID {
|
||||
fmt.Println(actor.ID)
|
||||
t.Fatalf("Failed - retrieved actor is invalid")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeActivityWithNoSignature(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
length := strconv.Itoa(len(body))
|
||||
req, _ := http.NewRequest("POST", "/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Add("content-length", length)
|
||||
req.Header.Add("content-type", "application/activity+json")
|
||||
req.Header.Add("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Add("digest", "SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=")
|
||||
|
||||
_, _, _, err := decodeActivity(req)
|
||||
if err.Error() != "neither \"Signature\" nor \"Authorization\" have signature parameters" {
|
||||
t.Fatalf("Failed - Accept request without signature")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeActivityWithNotFoundKeyId(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
length := strconv.Itoa(len(body))
|
||||
req, _ := http.NewRequest("POST", "/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Add("content-length", length)
|
||||
req.Header.Add("content-type", "application/activity+json")
|
||||
req.Header.Add("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Add("digest", "SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=")
|
||||
req.Header.Add("signature", `keyId="https://innocent.yukimochi.io/users/admin#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
|
||||
_, _, _, err := decodeActivity(req)
|
||||
if err.Error() != "404 Not Found" {
|
||||
t.Fatalf("Failed - Accept notfound KeyId")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeActivityWithInvalidDigest(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
length := strconv.Itoa(len(body))
|
||||
req, _ := http.NewRequest("POST", "/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Add("content-length", length)
|
||||
req.Header.Add("content-type", "application/activity+json")
|
||||
req.Header.Add("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Add("digest", "SHA-256=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
||||
req.Header.Add("signature", `keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
|
||||
_, _, _, err := decodeActivity(req)
|
||||
if err.Error() != "crypto/rsa: verification error" {
|
||||
t.Fatalf("Failed - Accept unvalid digest")
|
||||
}
|
||||
}
|
|
@ -1,16 +1,14 @@
|
|||
package main
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1/tasks"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func handleWebfinger(writer http.ResponseWriter, request *http.Request) {
|
||||
|
@ -21,13 +19,13 @@ func handleWebfinger(writer http.ResponseWriter, request *http.Request) {
|
|||
} else {
|
||||
request := resource[0]
|
||||
if request == WebfingerResource.Subject {
|
||||
wfresource, err := json.Marshal(&WebfingerResource)
|
||||
webfingerResource, err := json.Marshal(&WebfingerResource)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
writer.Header().Add("Content-Type", "application/json")
|
||||
writer.WriteHeader(200)
|
||||
writer.Write(wfresource)
|
||||
writer.Write(webfingerResource)
|
||||
} else {
|
||||
writer.WriteHeader(404)
|
||||
writer.Write(nil)
|
||||
|
@ -35,6 +33,40 @@ func handleWebfinger(writer http.ResponseWriter, request *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func handleNodeinfoLink(writer http.ResponseWriter, request *http.Request) {
|
||||
if request.Method != "GET" {
|
||||
writer.WriteHeader(400)
|
||||
writer.Write(nil)
|
||||
} else {
|
||||
linksResource, err := json.Marshal(&Nodeinfo.NodeinfoLinks)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
writer.Header().Add("Content-Type", "application/json")
|
||||
writer.WriteHeader(200)
|
||||
writer.Write(linksResource)
|
||||
}
|
||||
}
|
||||
|
||||
func handleNodeinfo(writer http.ResponseWriter, request *http.Request) {
|
||||
if request.Method != "GET" {
|
||||
writer.WriteHeader(400)
|
||||
writer.Write(nil)
|
||||
} else {
|
||||
userCount := len(relayState.Subscriptions)
|
||||
Nodeinfo.Nodeinfo.Usage.Users.Total = userCount
|
||||
Nodeinfo.Nodeinfo.Usage.Users.ActiveMonth = userCount
|
||||
Nodeinfo.Nodeinfo.Usage.Users.ActiveHalfyear = userCount
|
||||
linksResource, err := json.Marshal(&Nodeinfo.Nodeinfo)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
writer.Header().Add("Content-Type", "application/json")
|
||||
writer.WriteHeader(200)
|
||||
writer.Write(linksResource)
|
||||
}
|
||||
}
|
||||
|
||||
func handleActor(writer http.ResponseWriter, request *http.Request) {
|
||||
if request.Method == "GET" {
|
||||
actor, err := json.Marshal(&Actor)
|
||||
|
@ -61,7 +93,7 @@ func contains(entries interface{}, finder string) bool {
|
|||
}
|
||||
}
|
||||
return false
|
||||
case []state.Subscription:
|
||||
case []models.Subscription:
|
||||
for i := 0; i < len(entry); i++ {
|
||||
if entry[i].Domain == finder {
|
||||
return true
|
||||
|
@ -93,16 +125,16 @@ func pushRelayJob(sourceInbox string, body []byte) {
|
|||
}
|
||||
_, err := machineryServer.SendTask(job)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func pushRegistorJob(inboxURL string, body []byte) {
|
||||
func pushRegisterJob(inboxURL string, body []byte) {
|
||||
job := &tasks.Signature{
|
||||
Name: "registor",
|
||||
RetryCount: 25,
|
||||
Name: "register",
|
||||
RetryCount: 2,
|
||||
Args: []tasks.Arg{
|
||||
{
|
||||
Name: "inboxURL",
|
||||
|
@ -118,27 +150,27 @@ func pushRegistorJob(inboxURL string, body []byte) {
|
|||
}
|
||||
_, err := machineryServer.SendTask(job)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func followAcceptable(activity *activitypub.Activity, actor *activitypub.Actor) error {
|
||||
func followAcceptable(activity *models.Activity, actor *models.Actor) error {
|
||||
if contains(activity.Object, "https://www.w3.org/ns/activitystreams#Public") {
|
||||
return nil
|
||||
} else {
|
||||
return nil
|
||||
return errors.New("Follow only allowed for https://www.w3.org/ns/activitystreams#Public")
|
||||
}
|
||||
}
|
||||
|
||||
func unFollowAcceptable(activity *activitypub.Activity, actor *activitypub.Actor) error {
|
||||
func unFollowAcceptable(activity *models.Activity, actor *models.Actor) error {
|
||||
if contains(activity.Object, "https://www.w3.org/ns/activitystreams#Public") {
|
||||
return nil
|
||||
} else {
|
||||
return nil
|
||||
return errors.New("Unfollow only allowed for https://www.w3.org/ns/activitystreams#Public")
|
||||
}
|
||||
}
|
||||
|
||||
func suitableFollow(activity *activitypub.Activity, actor *activitypub.Actor) bool {
|
||||
func suitableFollow(activity *models.Activity, actor *models.Actor) bool {
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
if contains(relayState.BlockedDomains, domain.Host) {
|
||||
return false
|
||||
|
@ -146,29 +178,29 @@ func suitableFollow(activity *activitypub.Activity, actor *activitypub.Actor) bo
|
|||
return true
|
||||
}
|
||||
|
||||
func relayAcceptable(activity *activitypub.Activity, actor *activitypub.Actor) error {
|
||||
func relayAcceptable(activity *models.Activity, actor *models.Actor) error {
|
||||
if !contains(activity.To, "https://www.w3.org/ns/activitystreams#Public") && !contains(activity.Cc, "https://www.w3.org/ns/activitystreams#Public") {
|
||||
return nil
|
||||
return errors.New("activity should contain https://www.w3.org/ns/activitystreams#Public as receiver")
|
||||
}
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
if contains(relayState.Subscriptions, domain.Host) {
|
||||
return nil
|
||||
}
|
||||
return errors.New("To use the relay service, Subscribe me in advance")
|
||||
return errors.New("to use the relay service, Subscribe me in advance")
|
||||
}
|
||||
|
||||
func suitableRelay(activity *activitypub.Activity, actor *activitypub.Actor) bool {
|
||||
func suitableRelay(activity *models.Activity, actor *models.Actor) bool {
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
if contains(relayState.LimitedDomains, domain.Host) {
|
||||
return false
|
||||
}
|
||||
if relayState.RelayConfig.BlockService && actor.Type == "Service" {
|
||||
if relayState.RelayConfig.BlockService && actor.Type != "Person" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func handleInbox(writer http.ResponseWriter, request *http.Request, activityDecoder func(*http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error)) {
|
||||
func handleInbox(writer http.ResponseWriter, request *http.Request, activityDecoder func(*http.Request) (*models.Activity, *models.Actor, []byte, error)) {
|
||||
switch request.Method {
|
||||
case "POST":
|
||||
activity, actor, body, err := activityDecoder(request)
|
||||
|
@ -176,16 +208,15 @@ func handleInbox(writer http.ResponseWriter, request *http.Request, activityDeco
|
|||
writer.WriteHeader(400)
|
||||
writer.Write(nil)
|
||||
} else {
|
||||
relayState.Load()
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
switch activity.Type {
|
||||
case "Follow":
|
||||
err = followAcceptable(activity, actor)
|
||||
if err != nil {
|
||||
resp := activity.GenerateResponse(hostURL, "Reject")
|
||||
resp := activity.GenerateResponse(globalConfig.ServerHostname(), "Reject")
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
go pushRegistorJob(actor.Endpoints.SharedInbox, jsonData)
|
||||
fmt.Println("Reject Follow Request : ", err.Error(), activity.Actor)
|
||||
go pushRegisterJob(actor.Inbox, jsonData)
|
||||
logrus.Error("Reject Follow Request : ", err.Error(), activity.Actor)
|
||||
|
||||
writer.WriteHeader(202)
|
||||
writer.Write(nil)
|
||||
|
@ -199,28 +230,24 @@ func handleInbox(writer http.ResponseWriter, request *http.Request, activityDeco
|
|||
"actor": actor.ID,
|
||||
"object": activity.Object.(string),
|
||||
})
|
||||
fmt.Println("Pending Follow Request : ", activity.Actor)
|
||||
logrus.Info("Pending Follow Request : ", activity.Actor)
|
||||
} else {
|
||||
resp := activity.GenerateResponse(hostURL, "Accept")
|
||||
resp := activity.GenerateResponse(globalConfig.ServerHostname(), "Accept")
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
go pushRegistorJob(actor.Endpoints.SharedInbox, jsonData)
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
go pushRegisterJob(actor.Inbox, jsonData)
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: actor.Endpoints.SharedInbox,
|
||||
ActivityID: activity.ID,
|
||||
ActorID: actor.ID,
|
||||
})
|
||||
fmt.Println("Accept Follow Request : ", activity.Actor)
|
||||
fb := activity.GenerateFollowbackRequest(hostURL)
|
||||
fbjsonData, _ := json.Marshal(&fb)
|
||||
go pushRegistorJob(actor.Endpoints.SharedInbox, fbjsonData)
|
||||
fmt.Println("Send Follow Back Request : ", activity.Actor)
|
||||
logrus.Info("Accept Follow Request : ", activity.Actor)
|
||||
}
|
||||
} else {
|
||||
resp := activity.GenerateResponse(hostURL, "Reject")
|
||||
resp := activity.GenerateResponse(globalConfig.ServerHostname(), "Reject")
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
go pushRegistorJob(actor.Endpoints.SharedInbox, jsonData)
|
||||
fmt.Println("Reject Follow Request : ", activity.Actor)
|
||||
go pushRegisterJob(actor.Inbox, jsonData)
|
||||
logrus.Info("Reject Follow Request : ", activity.Actor)
|
||||
}
|
||||
|
||||
writer.WriteHeader(202)
|
||||
|
@ -231,12 +258,12 @@ func handleInbox(writer http.ResponseWriter, request *http.Request, activityDeco
|
|||
if nestedActivity.Type == "Follow" && nestedActivity.Actor == activity.Actor {
|
||||
err = unFollowAcceptable(nestedActivity, actor)
|
||||
if err != nil {
|
||||
fmt.Println("Reject Unfollow Request : ", err.Error())
|
||||
logrus.Error("Reject Unfollow Request : ", err.Error())
|
||||
writer.WriteHeader(400)
|
||||
writer.Write([]byte(err.Error()))
|
||||
} else {
|
||||
relayState.RedisClient.Del("relay:subscription:" + domain.Host)
|
||||
fmt.Println("Accept Unfollow Request : ", activity.Actor)
|
||||
relayState.DelSubscription(domain.Host)
|
||||
logrus.Info("Accept Unfollow Request : ", activity.Actor)
|
||||
|
||||
writer.WriteHeader(202)
|
||||
writer.Write(nil)
|
||||
|
@ -249,36 +276,13 @@ func handleInbox(writer http.ResponseWriter, request *http.Request, activityDeco
|
|||
} else {
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
go pushRelayJob(domain.Host, body)
|
||||
fmt.Println("Accept Relay Status : ", activity.Actor)
|
||||
logrus.Debug("Accept Relay Status : ", activity.Actor)
|
||||
|
||||
writer.WriteHeader(202)
|
||||
writer.Write(nil)
|
||||
}
|
||||
}
|
||||
case "Announce":
|
||||
err = relayAcceptable(activity, actor)
|
||||
if err != nil {
|
||||
writer.WriteHeader(400)
|
||||
writer.Write([]byte(err.Error()))
|
||||
} else {
|
||||
if suitableRelay(activity, actor) {
|
||||
resp := activity.GenerateAnnounce(hostURL)
|
||||
if value, ok := activity.Object.(string); ok {
|
||||
resp.Object = value
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
go pushRelayJob(domain.Host, jsonData)
|
||||
fmt.Println("Swapping Announce : ", activity.Actor)
|
||||
} else {
|
||||
fmt.Println("Skipping Relay Status : ", activity.Actor)
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Skipping Relay Status : ", activity.Actor)
|
||||
}
|
||||
|
||||
writer.WriteHeader(202)
|
||||
writer.Write(nil)
|
||||
}
|
||||
case "Create", "Update", "Delete":
|
||||
case "Create", "Update", "Delete", "Announce", "Move":
|
||||
err = relayAcceptable(activity, actor)
|
||||
if err != nil {
|
||||
writer.WriteHeader(400)
|
||||
|
@ -288,23 +292,23 @@ func handleInbox(writer http.ResponseWriter, request *http.Request, activityDeco
|
|||
if relayState.RelayConfig.CreateAsAnnounce && activity.Type == "Create" {
|
||||
nestedObject, err := activity.NestedActivity()
|
||||
if err != nil {
|
||||
fmt.Println("Fail Assert activity : activity.Actor")
|
||||
logrus.Error("Fail Decode Activity : ", err.Error())
|
||||
}
|
||||
switch nestedObject.Type {
|
||||
case "Note":
|
||||
resp := nestedObject.GenerateAnnounce(hostURL)
|
||||
resp := nestedObject.GenerateAnnounce(globalConfig.ServerHostname())
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
go pushRelayJob(domain.Host, jsonData)
|
||||
fmt.Println("Accept Announce Note : ", activity.Actor)
|
||||
logrus.Debug("Accept Announce Note : ", activity.Actor)
|
||||
default:
|
||||
fmt.Println("Skipping Announce", nestedObject.Type, ": ", activity.Actor)
|
||||
logrus.Debug("Skipping Announce", nestedObject.Type, ": ", activity.Actor)
|
||||
}
|
||||
} else {
|
||||
go pushRelayJob(domain.Host, body)
|
||||
fmt.Println("Accept Relay Status : ", activity.Actor)
|
||||
logrus.Debug("Accept Relay Status : ", activity.Actor)
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Skipping Relay Status : ", activity.Actor)
|
||||
logrus.Debug("Skipping Relay Status : ", activity.Actor)
|
||||
}
|
||||
|
||||
writer.WriteHeader(202)
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
@ -11,12 +11,11 @@ import (
|
|||
"strconv"
|
||||
"testing"
|
||||
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
const (
|
||||
BlockService state.Config = iota
|
||||
BlockService models.Config = iota
|
||||
ManuallyAccept
|
||||
CreateAsAnnounce
|
||||
)
|
||||
|
@ -27,7 +26,7 @@ func TestHandleWebfingerGet(t *testing.T) {
|
|||
|
||||
req, _ := http.NewRequest("GET", s.URL, nil)
|
||||
q := req.URL.Query()
|
||||
q.Add("resource", "acct:relay@"+hostURL.Host)
|
||||
q.Add("resource", "acct:relay@"+globalConfig.ServerHostname().Host)
|
||||
req.URL.RawQuery = q.Encode()
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
|
@ -43,14 +42,14 @@ func TestHandleWebfingerGet(t *testing.T) {
|
|||
defer r.Body.Close()
|
||||
|
||||
data, _ := ioutil.ReadAll(r.Body)
|
||||
var wfresource activitypub.WebfingerResource
|
||||
err = json.Unmarshal(data, &wfresource)
|
||||
var webfingerResource models.WebfingerResource
|
||||
err = json.Unmarshal(data, &webfingerResource)
|
||||
if err != nil {
|
||||
t.Fatalf("WebfingerResource responce is not valid.")
|
||||
t.Fatalf("WebfingerResource response is not valid.")
|
||||
}
|
||||
|
||||
domain, _ := url.Parse(wfresource.Links[0].Href)
|
||||
if domain.Host != hostURL.Host {
|
||||
domain, _ := url.Parse(webfingerResource.Links[0].Href)
|
||||
if domain.Host != globalConfig.ServerHostname().Host {
|
||||
t.Fatalf("WebfingerResource's Host not valid.")
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +72,88 @@ func TestHandleWebfingerGetBadResource(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHandleNodeinfoLinkGet(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(handleNodeinfoLink))
|
||||
defer s.Close()
|
||||
|
||||
req, _ := http.NewRequest("GET", s.URL, nil)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.Header.Get("Content-Type") != "application/json" {
|
||||
t.Fatalf("Failed - Content-Type not match.")
|
||||
}
|
||||
if r.StatusCode != 200 {
|
||||
t.Fatalf("Failed - StatusCode is not 200.")
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
data, _ := ioutil.ReadAll(r.Body)
|
||||
var nodeinfoLinks models.NodeinfoLinks
|
||||
err = json.Unmarshal(data, &nodeinfoLinks)
|
||||
if err != nil {
|
||||
t.Fatalf("NodeinfoLinks response is not valid.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleNodeinfoLinkInvalidMethod(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(handleNodeinfoLink))
|
||||
defer s.Close()
|
||||
|
||||
req, _ := http.NewRequest("POST", s.URL, nil)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 400 {
|
||||
t.Fatalf("Failed - StatusCode is not 400.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleNodeinfoGet(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(handleNodeinfo))
|
||||
defer s.Close()
|
||||
|
||||
req, _ := http.NewRequest("GET", s.URL, nil)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.Header.Get("Content-Type") != "application/json" {
|
||||
t.Fatalf("Failed - Content-Type not match.")
|
||||
}
|
||||
if r.StatusCode != 200 {
|
||||
t.Fatalf("Failed - StatusCode is not 200.")
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
data, _ := ioutil.ReadAll(r.Body)
|
||||
var nodeinfo models.Nodeinfo
|
||||
err = json.Unmarshal(data, &nodeinfo)
|
||||
if err != nil {
|
||||
t.Fatalf("Nodeinfo response is not valid.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleNodeinfoInvalidMethod(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(handleNodeinfo))
|
||||
defer s.Close()
|
||||
|
||||
req, _ := http.NewRequest("POST", s.URL, nil)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 400 {
|
||||
t.Fatalf("Failed - StatusCode is not 400.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleWebfingerInvalidMethod(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(handleWebfinger))
|
||||
defer s.Close()
|
||||
|
@ -105,14 +186,14 @@ func TestHandleActorGet(t *testing.T) {
|
|||
defer r.Body.Close()
|
||||
|
||||
data, _ := ioutil.ReadAll(r.Body)
|
||||
var actor activitypub.Actor
|
||||
var actor models.Actor
|
||||
err = json.Unmarshal(data, &actor)
|
||||
if err != nil {
|
||||
t.Fatalf("Actor responce is not valid.")
|
||||
t.Fatalf("Actor response is not valid.")
|
||||
}
|
||||
|
||||
domain, _ := url.Parse(actor.ID)
|
||||
if domain.Host != hostURL.Host {
|
||||
if domain.Host != globalConfig.ServerHostname().Host {
|
||||
t.Fatalf("Actor's Host not valid.")
|
||||
}
|
||||
}
|
||||
|
@ -159,8 +240,8 @@ func TestContains(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func mockActivityDecoderProvider(activity *activitypub.Activity, actor *activitypub.Actor) func(r *http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error) {
|
||||
return func(r *http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error) {
|
||||
func mockActivityDecoderProvider(activity *models.Activity, actor *models.Actor) func(r *http.Request) (*models.Activity, *models.Actor, []byte, error) {
|
||||
return func(r *http.Request) (*models.Activity, *models.Actor, []byte, error) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -170,80 +251,86 @@ func mockActivityDecoderProvider(activity *activitypub.Activity, actor *activity
|
|||
}
|
||||
}
|
||||
|
||||
func mockActivity(req string) activitypub.Activity {
|
||||
func mockActivity(req string) models.Activity {
|
||||
switch req {
|
||||
case "Follow":
|
||||
file, _ := os.Open("./misc/follow.json")
|
||||
file, _ := os.Open("../misc/test/follow.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
case "Invalid-Follow":
|
||||
file, _ := os.Open("./misc/followAsActor.json")
|
||||
file, _ := os.Open("../misc/test/followAsActor.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
case "Unfollow":
|
||||
file, _ := os.Open("./misc/unfollow.json")
|
||||
file, _ := os.Open("../misc/test/unfollow.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
case "Invalid-Unfollow":
|
||||
body := "{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"https://mastodon.test.yukimochi.io/c125e836-e622-478e-a22d-2d9fbf2f496f\",\"type\":\"Undo\",\"actor\":\"https://mastodon.test.yukimochi.io/users/yukimochi\",\"object\":{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"https://hacked.test.yukimochi.io/c125e836-e622-478e-a22d-2d9fbf2f496f\",\"type\":\"Follow\",\"actor\":\"https://hacked.test.yukimochi.io/users/yukimochi\",\"object\":\"https://www.w3.org/ns/activitystreams#Public\"}}"
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal([]byte(body), &activity)
|
||||
return activity
|
||||
case "UnfollowAsActor":
|
||||
body := "{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"https://mastodon.test.yukimochi.io/c125e836-e622-478e-a22d-2d9fbf2f496f\",\"type\":\"Undo\",\"actor\":\"https://mastodon.test.yukimochi.io/users/yukimochi\",\"object\":{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"https://hacked.test.yukimochi.io/c125e836-e622-478e-a22d-2d9fbf2f496f\",\"type\":\"Follow\",\"actor\":\"https://mastodon.test.yukimochi.io/users/yukimochi\",\"object\":\"https://relay.yukimochi.example.org/actor\"}}"
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal([]byte(body), &activity)
|
||||
return activity
|
||||
case "Create":
|
||||
file, _ := os.Open("./misc/create.json")
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
case "Create-Article":
|
||||
body := "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://mastodon.test.yukimochi.io/users/yukimochi/statuses/101075045564444857/activity\",\"type\":\"Create\",\"actor\":\"https://mastodon.test.yukimochi.io/users/yukimochi\",\"published\":\"2018-11-15T11:07:26Z\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://mastodon.test.yukimochi.io/users/yukimochi/followers\"],\"object\":{\"id\":\"https://mastodon.test.yukimochi.io/users/yukimochi/statuses/101075045564444857\",\"type\":\"Article\",\"summary\":null,\"inReplyTo\":null,\"published\":\"2018-11-15T11:07:26Z\",\"url\":\"https://mastodon.test.yukimochi.io/@yukimochi/101075045564444857\",\"attributedTo\":\"https://mastodon.test.yukimochi.io/users/yukimochi\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://mastodon.test.yukimochi.io/users/yukimochi/followers\"],\"sensitive\":false,\"atomUri\":\"https://mastodon.test.yukimochi.io/users/yukimochi/statuses/101075045564444857\",\"inReplyToAtomUri\":null,\"conversation\":\"tag:mastodon.test.yukimochi.io,2018-11-15:objectId=68:objectType=Conversation\",\"content\":\"<p>Actvity-Relay</p>\",\"contentMap\":{\"en\":\"<p>Actvity-Relay</p>\"},\"attachment\":[],\"tag\":[]},\"signature\":{\"type\":\"RsaSignature2017\",\"creator\":\"https://mastodon.test.yukimochi.io/users/yukimochi#main-key\",\"created\":\"2018-11-15T11:07:26Z\",\"signatureValue\":\"mMgl2GgVPgb1Kw6a2iDIZc7r0j3ob+Cl9y+QkCxIe6KmnUzb15e60UuhkE5j3rJnoTwRKqOFy1PMkSxlYW6fPG/5DBxW9I4kX+8sw8iH/zpwKKUOnXUJEqfwRrNH2ix33xcs/GkKPdedY6iAPV9vGZ10MSMOdypfYgU9r+UI0sTaaC2iMXH0WPnHQuYAI+Q1JDHIbDX5FH1WlDL6+8fKAicf3spBMxDwPHGPK8W2jmDLWdN2Vz4ffsCtWs5BCuqOKZrtTW0Rdd4HWzo40MnRXvBjv7yNlnnKzokANBqiOLWT7kNfK0+Vtnt6c/bNX64KBro53KR7wL3ZBvPVuv5rdQ==\"}}"
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal([]byte(body), &activity)
|
||||
return activity
|
||||
case "Announce":
|
||||
file, _ := os.Open("./misc/announce.json")
|
||||
file, _ := os.Open("../misc/test/announce.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
case "Undo":
|
||||
file, _ := os.Open("./misc/undo.json")
|
||||
file, _ := os.Open("../misc/test/undo.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var activity activitypub.Activity
|
||||
var activity models.Activity
|
||||
json.Unmarshal(body, &activity)
|
||||
return activity
|
||||
default:
|
||||
panic("No assined request.")
|
||||
panic("No assigned request.")
|
||||
}
|
||||
}
|
||||
|
||||
func mockActor(req string) activitypub.Actor {
|
||||
func mockActor(req string) models.Actor {
|
||||
switch req {
|
||||
case "Person":
|
||||
file, _ := os.Open("./misc/person.json")
|
||||
file, _ := os.Open("../misc/test/person.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var actor activitypub.Actor
|
||||
var actor models.Actor
|
||||
json.Unmarshal(body, &actor)
|
||||
return actor
|
||||
case "Service":
|
||||
file, _ := os.Open("./misc/service.json")
|
||||
file, _ := os.Open("../misc/test/service.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var actor activitypub.Actor
|
||||
var actor models.Actor
|
||||
json.Unmarshal(body, &actor)
|
||||
return actor
|
||||
case "Application":
|
||||
file, _ := os.Open("../misc/test/application.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
var actor models.Actor
|
||||
json.Unmarshal(body, &actor)
|
||||
return actor
|
||||
default:
|
||||
panic("No assined request.")
|
||||
panic("No assigned request.")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,6 +338,7 @@ func TestSuitableRelayNoBlockService(t *testing.T) {
|
|||
activity := mockActivity("Create")
|
||||
personActor := mockActor("Person")
|
||||
serviceActor := mockActor("Service")
|
||||
applicationActor := mockActor("Application")
|
||||
|
||||
relayState.SetConfig(BlockService, false)
|
||||
|
||||
|
@ -260,12 +348,16 @@ func TestSuitableRelayNoBlockService(t *testing.T) {
|
|||
if suitableRelay(&activity, &serviceActor) != true {
|
||||
t.Fatalf("Failed - Service status not relay")
|
||||
}
|
||||
if suitableRelay(&activity, &applicationActor) != true {
|
||||
t.Fatalf("Failed - Service status not relay")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSuitableRelayBlockService(t *testing.T) {
|
||||
activity := mockActivity("Create")
|
||||
personActor := mockActor("Person")
|
||||
serviceActor := mockActor("Service")
|
||||
applicationActor := mockActor("Application")
|
||||
|
||||
relayState.SetConfig(BlockService, true)
|
||||
|
||||
|
@ -275,6 +367,9 @@ func TestSuitableRelayBlockService(t *testing.T) {
|
|||
if suitableRelay(&activity, &serviceActor) != false {
|
||||
t.Fatalf("Failed - Service status may relay when blocking mode")
|
||||
}
|
||||
if suitableRelay(&activity, &applicationActor) != false {
|
||||
t.Fatalf("Failed - Application status may relay when blocking mode")
|
||||
}
|
||||
relayState.SetConfig(BlockService, false)
|
||||
}
|
||||
|
||||
|
@ -433,7 +528,7 @@ func TestHandleInboxValidUnfollow(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
|
@ -463,7 +558,7 @@ func TestHandleInboxInvalidUnfollow(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
|
@ -493,7 +588,7 @@ func TestHandleInboxUnfollowAsActor(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
|
@ -523,11 +618,11 @@ func TestHandleInboxValidCreate(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "example.org",
|
||||
InboxURL: "https://example.org/inbox",
|
||||
})
|
||||
|
@ -547,7 +642,7 @@ func TestHandleInboxValidCreate(t *testing.T) {
|
|||
relayState.RedisClient.Del("relay:subscription:example.org").Result()
|
||||
}
|
||||
|
||||
func TestHandleInboxlimitedCreate(t *testing.T) {
|
||||
func TestHandleInboxLimitedCreate(t *testing.T) {
|
||||
activity := mockActivity("Create")
|
||||
actor := mockActor("Person")
|
||||
domain, _ := url.Parse(activity.Actor)
|
||||
|
@ -556,7 +651,7 @@ func TestHandleInboxlimitedCreate(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
|
@ -584,11 +679,11 @@ func TestHandleInboxValidCreateAsAnnounceNote(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "example.org",
|
||||
InboxURL: "https://example.org/inbox",
|
||||
})
|
||||
|
@ -617,11 +712,11 @@ func TestHandleInboxValidCreateAsAnnounceNoNote(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: "example.org",
|
||||
InboxURL: "https://example.org/inbox",
|
||||
})
|
||||
|
@ -669,7 +764,7 @@ func TestHandleInboxUndo(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain.Host,
|
||||
InboxURL: "https://mastodon.test.yukimochi.io/inbox",
|
||||
})
|
88
cli/cli.go
88
cli/cli.go
|
@ -1,88 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/RichardKnop/machinery/v1/config"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor activitypub.Actor
|
||||
|
||||
hostname *url.URL
|
||||
hostkey *rsa.PrivateKey
|
||||
relayState state.RelayState
|
||||
machineryServer *machinery.Server
|
||||
)
|
||||
|
||||
func initConfig() {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath(".")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
fmt.Println("Config file is not exists. Use environment variables.")
|
||||
viper.BindEnv("actor_pem")
|
||||
viper.BindEnv("redis_url")
|
||||
viper.BindEnv("relay_bind")
|
||||
viper.BindEnv("relay_domain")
|
||||
viper.BindEnv("relay_servicename")
|
||||
} else {
|
||||
Actor.Summary = viper.GetString("relay_summary")
|
||||
Actor.Icon = activitypub.Image{URL: viper.GetString("relay_icon")}
|
||||
Actor.Image = activitypub.Image{URL: viper.GetString("relay_image")}
|
||||
}
|
||||
Actor.Name = viper.GetString("relay_servicename")
|
||||
|
||||
hostname, err = url.Parse("https://" + viper.GetString("relay_domain"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
hostkey, err := keyloader.ReadPrivateKeyRSAfromPath(viper.GetString("actor_pem"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
redisOption, err := redis.ParseURL(viper.GetString("redis_url"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
redisClient := redis.NewClient(redisOption)
|
||||
relayState = state.NewState(redisClient)
|
||||
var machineryConfig = &config.Config{
|
||||
Broker: viper.GetString("redis_url"),
|
||||
DefaultQueue: "relay",
|
||||
ResultBackend: viper.GetString("redis_url"),
|
||||
ResultsExpireIn: 5,
|
||||
}
|
||||
machineryServer, err = machinery.NewServer(machineryConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Actor.GenerateSelfKey(hostname, &hostkey.PublicKey)
|
||||
}
|
||||
|
||||
func buildNewCmd() *cobra.Command {
|
||||
var app = &cobra.Command{}
|
||||
app.AddCommand(domainCmdInit())
|
||||
app.AddCommand(followCmdInit())
|
||||
app.AddCommand(configCmdInit())
|
||||
return app
|
||||
}
|
||||
|
||||
func main() {
|
||||
initConfig()
|
||||
var app = buildNewCmd()
|
||||
app.Execute()
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
viper.Set("actor_pem", "../misc/testKey.pem")
|
||||
viper.Set("relay_domain", "relay.yukimochi.example.org")
|
||||
initConfig()
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
actor_pem: /actor.pem
|
||||
redis_url: redis://redis:6379
|
||||
|
||||
relay_bind: 0.0.0.0:8080
|
||||
relay_domain: relay.toot.yukimochi.jp
|
||||
relay_servicename: YUKIMOCHI Toot Relay Service
|
||||
# relay_summary: |
|
||||
|
||||
# relay_icon: https://
|
||||
# relay_image: https://
|
|
@ -0,0 +1,11 @@
|
|||
ACTOR_PEM: /var/lib/relay/actor.pem
|
||||
REDIS_URL: redis://redis:6379
|
||||
|
||||
RELAY_BIND: 0.0.0.0:8080
|
||||
RELAY_DOMAIN: relay.toot.yukimochi.jp
|
||||
RELAY_SERVICENAME: YUKIMOCHI Toot Relay Service
|
||||
JOB_CONCURRENCY: 50
|
||||
# RELAY_SUMMARY: |
|
||||
|
||||
# RELAY_ICON: https://
|
||||
# RELAY_IMAGE: https://
|
|
@ -1,17 +1,17 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
const (
|
||||
BlockService state.Config = iota
|
||||
BlockService models.Config = iota
|
||||
ManuallyAccept
|
||||
CreateAsAnnounce
|
||||
)
|
||||
|
@ -20,14 +20,16 @@ func configCmdInit() *cobra.Command {
|
|||
var config = &cobra.Command{
|
||||
Use: "config",
|
||||
Short: "Manage configuration for relay",
|
||||
Long: "Enable/disable relay costomize and import/export relay database.",
|
||||
Long: "Enable/disable relay customize and import/export relay database.",
|
||||
}
|
||||
|
||||
var configList = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List all relay configration",
|
||||
Long: "List all relay configration.",
|
||||
Run: listConfig,
|
||||
Short: "List all relay configuration",
|
||||
Long: "List all relay configuration.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
initProxy(listConfig, cmd, args)
|
||||
},
|
||||
}
|
||||
config.AddCommand(configList)
|
||||
|
||||
|
@ -35,7 +37,9 @@ func configCmdInit() *cobra.Command {
|
|||
Use: "export",
|
||||
Short: "Export all relay information",
|
||||
Long: "Export all relay information by JSON format.",
|
||||
Run: exportConfig,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
initProxy(exportConfig, cmd, args)
|
||||
},
|
||||
}
|
||||
config.AddCommand(configExport)
|
||||
|
||||
|
@ -43,7 +47,9 @@ func configCmdInit() *cobra.Command {
|
|||
Use: "import [flags]",
|
||||
Short: "Import all relay information",
|
||||
Long: "Import all relay information from JSON file.",
|
||||
Run: importConfig,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
initProxy(importConfig, cmd, args)
|
||||
},
|
||||
}
|
||||
configImport.Flags().String("json", "", "JSON file-path")
|
||||
configImport.MarkFlagRequired("json")
|
||||
|
@ -51,8 +57,8 @@ func configCmdInit() *cobra.Command {
|
|||
|
||||
var configEnable = &cobra.Command{
|
||||
Use: "enable",
|
||||
Short: "Enable/disable relay configration",
|
||||
Long: `Enable or disable relay configration.
|
||||
Short: "Enable/disable relay configuration",
|
||||
Long: `Enable or disable relay configuration.
|
||||
- service-block
|
||||
Blocking feature for service-type actor.
|
||||
- manually-accept
|
||||
|
@ -60,9 +66,11 @@ func configCmdInit() *cobra.Command {
|
|||
- create-as-announce
|
||||
Enable announce activity instead of relay create activity (not recommend)`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: configEnable,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(configEnable, cmd, args)
|
||||
},
|
||||
}
|
||||
configEnable.Flags().BoolP("disable", "d", false, "Disable configration instead of Enable")
|
||||
configEnable.Flags().BoolP("disable", "d", false, "Disable configuration instead of Enable")
|
||||
config.AddCommand(configEnable)
|
||||
|
||||
return config
|
||||
|
@ -118,18 +126,18 @@ func exportConfig(cmd *cobra.Command, args []string) {
|
|||
func importConfig(cmd *cobra.Command, args []string) {
|
||||
file, err := os.Open(cmd.Flag("json").Value.String())
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
jsonData, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
var data state.RelayState
|
||||
var data models.RelayState
|
||||
err = json.Unmarshal(jsonData, &data)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -154,12 +162,12 @@ func importConfig(cmd *cobra.Command, args []string) {
|
|||
cmd.Println("Set [" + BlockedDomain + "] as blocked domain")
|
||||
}
|
||||
for _, Subscription := range data.Subscriptions {
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: Subscription.Domain,
|
||||
InboxURL: Subscription.InboxURL,
|
||||
ActivityID: Subscription.ActivityID,
|
||||
ActorID: Subscription.ActorID,
|
||||
})
|
||||
cmd.Println("Regist [" + Subscription.Domain + "] as subscriber")
|
||||
cmd.Println("Register [" + Subscription.Domain + "] as subscriber")
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -9,73 +9,89 @@ import (
|
|||
)
|
||||
|
||||
func TestServiceBlock(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.SetConfig(BlockService, false)
|
||||
app.SetArgs([]string{"config", "enable", "service-block"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"enable", "service-block"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if !relayState.RelayConfig.BlockService {
|
||||
t.Fatalf("Not Enabled Blocking feature for service-type actor")
|
||||
}
|
||||
|
||||
app.SetArgs([]string{"config", "enable", "-d", "service-block"})
|
||||
app.SetArgs([]string{"enable", "-d", "service-block"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if relayState.RelayConfig.BlockService {
|
||||
t.Fatalf("Not Disabled Blocking feature for service-type actor")
|
||||
}
|
||||
}
|
||||
func TestManuallyAccept(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
|
||||
relayState.SetConfig(ManuallyAccept, false)
|
||||
app.SetArgs([]string{"config", "enable", "manually-accept"})
|
||||
func TestManuallyAccept(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"enable", "manually-accept"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if !relayState.RelayConfig.ManuallyAccept {
|
||||
t.Fatalf("Not Enabled Manually accept follow-request feature")
|
||||
}
|
||||
|
||||
app.SetArgs([]string{"config", "enable", "-d", "manually-accept"})
|
||||
app.SetArgs([]string{"enable", "-d", "manually-accept"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if relayState.RelayConfig.ManuallyAccept {
|
||||
t.Fatalf("Not Disabled Manually accept follow-request feature")
|
||||
}
|
||||
}
|
||||
func TestCreateAsAnnounce(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
|
||||
relayState.SetConfig(CreateAsAnnounce, false)
|
||||
app.SetArgs([]string{"config", "enable", "create-as-announce"})
|
||||
func TestCreateAsAnnounce(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"enable", "create-as-announce"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if !relayState.RelayConfig.CreateAsAnnounce {
|
||||
t.Fatalf("Enable announce activity instead of relay create activity")
|
||||
}
|
||||
|
||||
app.SetArgs([]string{"config", "enable", "-d", "create-as-announce"})
|
||||
app.SetArgs([]string{"enable", "-d", "create-as-announce"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
if relayState.RelayConfig.CreateAsAnnounce {
|
||||
t.Fatalf("Enable announce activity instead of relay create activity")
|
||||
}
|
||||
}
|
||||
func TestInvalidConfig(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"config", "enable", "hoge"})
|
||||
func TestInvalidConfig(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := configCmdInit()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"enable", "hoge"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != "Invalid config given" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestListConfig(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "list"})
|
||||
app := configCmdInit()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"list"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
|
@ -83,60 +99,63 @@ func TestListConfig(t *testing.T) {
|
|||
switch strings.Split(row, ":")[0] {
|
||||
case "Blocking for service-type actor ":
|
||||
if strings.Split(row, ":")[1] == " true" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
case "Manually accept follow-request ":
|
||||
if strings.Split(row, ":")[1] == " true" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
case "Announce activity instead of relay create activity ":
|
||||
if strings.Split(row, ":")[1] == " true" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExportConfig(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"config", "export"})
|
||||
app.Execute()
|
||||
|
||||
file, err := os.Open("../misc/blankConfig.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Test resource fetch error.")
|
||||
}
|
||||
jsonData, err := ioutil.ReadAll(file)
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != string(jsonData) {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
}
|
||||
}
|
||||
func TestImportConfig(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app.Execute()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"config", "export"})
|
||||
app.Execute()
|
||||
|
||||
file, err := os.Open("../misc/exampleConfig.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Test resource fetch error.")
|
||||
}
|
||||
jsonData, err := ioutil.ReadAll(file)
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != string(jsonData) {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
|
||||
app := configCmdInit()
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"export"})
|
||||
app.Execute()
|
||||
|
||||
file, err := os.Open("../misc/test/blankConfig.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Test resource fetch error.")
|
||||
}
|
||||
jsonData, _ := ioutil.ReadAll(file)
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != string(jsonData) {
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportConfig(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"export"})
|
||||
app.Execute()
|
||||
|
||||
file, err := os.Open("../misc/test/exampleConfig.json")
|
||||
if err != nil {
|
||||
t.Fatalf("Test resource fetch error.")
|
||||
}
|
||||
jsonData, _ := ioutil.ReadAll(file)
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != string(jsonData) {
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
var (
|
||||
globalConfig *models.RelayConfig
|
||||
|
||||
initProxy = initializeProxy
|
||||
initProxyE = initializeProxyE
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor models.Actor
|
||||
|
||||
relayState models.RelayState
|
||||
machineryServer *machinery.Server
|
||||
)
|
||||
|
||||
func BuildCommand(command *cobra.Command) {
|
||||
command.AddCommand(configCmdInit())
|
||||
command.AddCommand(domainCmdInit())
|
||||
command.AddCommand(followCmdInit())
|
||||
}
|
||||
|
||||
func initializeProxy(function func(cmd *cobra.Command, args []string), cmd *cobra.Command, args []string) {
|
||||
initConfig(cmd)
|
||||
function(cmd, args)
|
||||
}
|
||||
|
||||
func initializeProxyE(function func(cmd *cobra.Command, args []string) error, cmd *cobra.Command, args []string) error {
|
||||
initConfig(cmd)
|
||||
return function(cmd, args)
|
||||
}
|
||||
|
||||
func initConfig(cmd *cobra.Command) error {
|
||||
var err error
|
||||
|
||||
configPath := cmd.Flag("config").Value.String()
|
||||
file, err := os.Open(configPath)
|
||||
defer file.Close()
|
||||
|
||||
if err == nil {
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
} else {
|
||||
logrus.Warn("Config file not exist. Use environment variables.")
|
||||
|
||||
viper.BindEnv("ACTOR_PEM")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
viper.BindEnv("RELAY_BIND")
|
||||
viper.BindEnv("RELAY_DOMAIN")
|
||||
viper.BindEnv("RELAY_SERVICENAME")
|
||||
viper.BindEnv("JOB_CONCURRENCY")
|
||||
viper.BindEnv("RELAY_SUMMARY")
|
||||
viper.BindEnv("RELAY_ICON")
|
||||
viper.BindEnv("RELAY_IMAGE")
|
||||
}
|
||||
|
||||
globalConfig, err = models.NewRelayConfig()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
initialize(globalConfig)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func initialize(globalconfig *models.RelayConfig) error {
|
||||
var err error
|
||||
|
||||
redisClient := globalConfig.RedisClient()
|
||||
relayState = models.NewState(redisClient, true)
|
||||
relayState.ListenNotify(nil)
|
||||
|
||||
machineryServer, err = models.NewMachineryServer(globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Actor = models.NewActivityPubActorFromSelfKey(globalConfig)
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
testConfigPath := "../misc/test/config.yml"
|
||||
file, _ := os.Open(testConfigPath)
|
||||
defer file.Close()
|
||||
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
viper.Set("ACTOR_PEM", "../misc/test/testKey.pem")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
|
||||
globalConfig, err = models.NewRelayConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = initialize(globalConfig)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
relayState = models.NewState(globalConfig.RedisClient(), false)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
initProxy = emptyProxy
|
||||
initProxyE = emptyProxyE
|
||||
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func emptyProxy(function func(cmd *cobra.Command, args []string), cmd *cobra.Command, args []string) {
|
||||
function(cmd, args)
|
||||
}
|
||||
|
||||
func emptyProxyE(function func(cmd *cobra.Command, args []string) error, cmd *cobra.Command, args []string) error {
|
||||
return function(cmd, args)
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func domainCmdInit() *cobra.Command {
|
||||
|
@ -20,7 +19,9 @@ func domainCmdInit() *cobra.Command {
|
|||
Use: "list [flags]",
|
||||
Short: "List domain",
|
||||
Long: "List domain which filtered given type.",
|
||||
RunE: listDomains,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(listDomains, cmd, args)
|
||||
},
|
||||
}
|
||||
domainList.Flags().StringP("type", "t", "subscriber", "domain type [subscriber,limited,blocked]")
|
||||
domain.AddCommand(domainList)
|
||||
|
@ -30,7 +31,9 @@ func domainCmdInit() *cobra.Command {
|
|||
Short: "Set or unset domain as limited or blocked",
|
||||
Long: "Set or unset domain as limited or blocked.",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: setDomainType,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(setDomainType, cmd, args)
|
||||
},
|
||||
}
|
||||
domainSet.Flags().StringP("type", "t", "", "Apply domain type [limited,blocked]")
|
||||
domainSet.MarkFlagRequired("type")
|
||||
|
@ -41,15 +44,17 @@ func domainCmdInit() *cobra.Command {
|
|||
Use: "unfollow [flags]",
|
||||
Short: "Send Unfollow request for given domains",
|
||||
Long: "Send unfollow request for given domains.",
|
||||
RunE: unfollowDomains,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(unfollowDomains, cmd, args)
|
||||
},
|
||||
}
|
||||
domain.AddCommand(domainUnfollow)
|
||||
|
||||
return domain
|
||||
}
|
||||
|
||||
func createUnfollowRequestResponse(subscription state.Subscription) error {
|
||||
activity := activitypub.Activity{
|
||||
func createUnfollowRequestResponse(subscription models.Subscription) error {
|
||||
activity := models.Activity{
|
||||
Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"},
|
||||
ID: subscription.ActivityID,
|
||||
Actor: subscription.ActorID,
|
||||
|
@ -57,9 +62,9 @@ func createUnfollowRequestResponse(subscription state.Subscription) error {
|
|||
Object: "https://www.w3.org/ns/activitystreams#Public",
|
||||
}
|
||||
|
||||
resp := activity.GenerateResponse(hostname, "Reject")
|
||||
resp := activity.GenerateResponse(globalConfig.ServerHostname(), "Reject")
|
||||
jsonData, _ := json.Marshal(&resp)
|
||||
pushRegistorJob(subscription.InboxURL, jsonData)
|
||||
pushRegisterJob(subscription.InboxURL, jsonData)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -121,9 +126,9 @@ func unfollowDomains(cmd *cobra.Command, args []string) error {
|
|||
for _, domain := range args {
|
||||
if contains(subscriptions, domain) {
|
||||
subscription := *relayState.SelectSubscription(domain)
|
||||
cmd.Println("Unfollow [" + subscription.Domain + "]")
|
||||
createUnfollowRequestResponse(subscription)
|
||||
relayState.DelSubscription(subscription.Domain)
|
||||
cmd.Println("Unfollow [" + subscription.Domain + "]")
|
||||
break
|
||||
} else {
|
||||
cmd.Println("Invalid domain [" + domain + "] given")
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -7,15 +7,18 @@ import (
|
|||
)
|
||||
|
||||
func TestListDomainSubscriber(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"domain", "list"})
|
||||
app = domainCmdInit()
|
||||
app.SetOut(buffer)
|
||||
app.SetArgs([]string{"list"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
|
@ -24,23 +27,24 @@ subscription.example.jp
|
|||
Total : 1
|
||||
`
|
||||
if output != valid {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestListDomainLimited(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"domain", "list", "-t", "limited"})
|
||||
app = domainCmdInit()
|
||||
app.SetOut(buffer)
|
||||
app.SetArgs([]string{"list", "-t", "limited"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
|
@ -49,23 +53,24 @@ limitedDomain.example.jp
|
|||
Total : 1
|
||||
`
|
||||
if output != valid {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestListDomainBlocked(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"domain", "list", "-t", "blocked"})
|
||||
app = domainCmdInit()
|
||||
app.SetOut(buffer)
|
||||
app.SetArgs([]string{"list", "-t", "blocked"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
|
@ -74,18 +79,18 @@ blockedDomain.example.jp
|
|||
Total : 1
|
||||
`
|
||||
if output != valid {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestSetDomainBlocked(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"domain", "set", "-t", "blocked", "testdomain.example.jp"})
|
||||
app := domainCmdInit()
|
||||
|
||||
app.SetArgs([]string{"set", "-t", "blocked", "testdomain.example.jp"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.BlockedDomains {
|
||||
|
@ -97,16 +102,16 @@ func TestSetDomainBlocked(t *testing.T) {
|
|||
if !valid {
|
||||
t.Fatalf("Not set blocked domain")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestSetDomainLimited(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"domain", "set", "-t", "limited", "testdomain.example.jp"})
|
||||
app := domainCmdInit()
|
||||
|
||||
app.SetArgs([]string{"set", "-t", "limited", "testdomain.example.jp"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.LimitedDomains {
|
||||
|
@ -118,19 +123,20 @@ func TestSetDomainLimited(t *testing.T) {
|
|||
if !valid {
|
||||
t.Fatalf("Not set limited domain")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestUnsetDomainBlocked(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
|
||||
app.SetArgs([]string{"domain", "set", "-t", "blocked", "-u", "blockedDomain.example.jp"})
|
||||
app = domainCmdInit()
|
||||
app.SetArgs([]string{"set", "-t", "blocked", "-u", "blockedDomain.example.jp"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
valid := true
|
||||
for _, domain := range relayState.BlockedDomains {
|
||||
|
@ -142,19 +148,20 @@ func TestUnsetDomainBlocked(t *testing.T) {
|
|||
if !valid {
|
||||
t.Fatalf("Not unset blocked domain")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestUnsetDomainLimited(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
|
||||
app.SetArgs([]string{"domain", "set", "-t", "limited", "-u", "limitedDomain.example.jp"})
|
||||
app = domainCmdInit()
|
||||
app.SetArgs([]string{"set", "-t", "limited", "-u", "limitedDomain.example.jp"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
valid := true
|
||||
for _, domain := range relayState.LimitedDomains {
|
||||
|
@ -166,40 +173,42 @@ func TestUnsetDomainLimited(t *testing.T) {
|
|||
if !valid {
|
||||
t.Fatalf("Not unset blocked domain")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestSetDomainInvalid(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"domain", "set", "-t", "hoge", "hoge.example.jp"})
|
||||
app = domainCmdInit()
|
||||
app.SetOut(buffer)
|
||||
app.SetArgs([]string{"set", "-t", "hoge", "hoge.example.jp"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != "Invalid type given" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestUnfollowDomain(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
|
||||
app.SetArgs([]string{"domain", "unfollow", "subscription.example.jp"})
|
||||
app = domainCmdInit()
|
||||
app.SetArgs([]string{"unfollow", "subscription.example.jp"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
valid := true
|
||||
for _, domain := range relayState.Subscriptions {
|
||||
|
@ -211,28 +220,26 @@ func TestUnfollowDomain(t *testing.T) {
|
|||
if !valid {
|
||||
t.Fatalf("Not unfollowed domain")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestInvalidUnfollowDomain(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
relayState.Load()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
|
||||
app.SetArgs([]string{"domain", "unfollow", "unknown.tld"})
|
||||
app = domainCmdInit()
|
||||
app.SetOut(buffer)
|
||||
app.SetArgs([]string{"unfollow", "unknown.tld"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != "Invalid domain [unknown.tld] given" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
|
@ -1,16 +1,15 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1/tasks"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func followCmdInit() *cobra.Command {
|
||||
|
@ -24,7 +23,9 @@ func followCmdInit() *cobra.Command {
|
|||
Use: "list",
|
||||
Short: "List follow request",
|
||||
Long: "List follow request.",
|
||||
RunE: listFollows,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(listFollows, cmd, args)
|
||||
},
|
||||
}
|
||||
follow.AddCommand(followList)
|
||||
|
||||
|
@ -33,7 +34,9 @@ func followCmdInit() *cobra.Command {
|
|||
Short: "Accept follow request",
|
||||
Long: "Accept follow request by domain.",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: acceptFollow,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(acceptFollow, cmd, args)
|
||||
},
|
||||
}
|
||||
follow.AddCommand(followAccept)
|
||||
|
||||
|
@ -42,7 +45,9 @@ func followCmdInit() *cobra.Command {
|
|||
Short: "Reject follow request",
|
||||
Long: "Reject follow request by domain.",
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: rejectFollow,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(rejectFollow, cmd, args)
|
||||
},
|
||||
}
|
||||
follow.AddCommand(followReject)
|
||||
|
||||
|
@ -50,16 +55,18 @@ func followCmdInit() *cobra.Command {
|
|||
Use: "update",
|
||||
Short: "Update actor object",
|
||||
Long: "Update actor object for whole subscribers.",
|
||||
RunE: updateActor,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return initProxyE(updateActor, cmd, args)
|
||||
},
|
||||
}
|
||||
follow.AddCommand(updateActor)
|
||||
|
||||
return follow
|
||||
}
|
||||
|
||||
func pushRegistorJob(inboxURL string, body []byte) {
|
||||
func pushRegisterJob(inboxURL string, body []byte) {
|
||||
job := &tasks.Signature{
|
||||
Name: "registor",
|
||||
Name: "register",
|
||||
RetryCount: 25,
|
||||
Args: []tasks.Arg{
|
||||
{
|
||||
|
@ -76,7 +83,7 @@ func pushRegistorJob(inboxURL string, body []byte) {
|
|||
}
|
||||
_, err := machineryServer.SendTask(job)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +92,7 @@ func createFollowRequestResponse(domain string, response string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
activity := activitypub.Activity{
|
||||
activity := models.Activity{
|
||||
Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"},
|
||||
ID: data["activity_id"],
|
||||
Actor: data["actor"],
|
||||
|
@ -93,15 +100,15 @@ func createFollowRequestResponse(domain string, response string) error {
|
|||
Object: data["object"],
|
||||
}
|
||||
|
||||
resp := activity.GenerateResponse(hostname, response)
|
||||
resp := activity.GenerateResponse(globalConfig.ServerHostname(), response)
|
||||
jsonData, err := json.Marshal(&resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pushRegistorJob(data["inbox_url"], jsonData)
|
||||
pushRegisterJob(data["inbox_url"], jsonData)
|
||||
relayState.RedisClient.Del("relay:pending:" + domain)
|
||||
if response == "Accept" {
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
relayState.AddSubscription(models.Subscription{
|
||||
Domain: domain,
|
||||
InboxURL: data["inbox_url"],
|
||||
ActivityID: data["activity_id"],
|
||||
|
@ -112,11 +119,11 @@ func createFollowRequestResponse(domain string, response string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func createUpdateActorActivity(subscription state.Subscription) error {
|
||||
activity := activitypub.Activity{
|
||||
func createUpdateActorActivity(subscription models.Subscription) error {
|
||||
activity := models.Activity{
|
||||
Context: []string{"https://www.w3.org/ns/activitystreams"},
|
||||
ID: hostname.String() + "/activities/" + uuid.NewV4().String(),
|
||||
Actor: hostname.String() + "/actor",
|
||||
ID: globalConfig.ServerHostname().String() + "/activities/" + uuid.NewV4().String(),
|
||||
Actor: globalConfig.ServerHostname().String() + "/actor",
|
||||
Type: "Update",
|
||||
To: []string{"https://www.w3.org/ns/activitystreams#Public"},
|
||||
Object: Actor,
|
||||
|
@ -126,7 +133,7 @@ func createUpdateActorActivity(subscription state.Subscription) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pushRegistorJob(subscription.InboxURL, jsonData)
|
||||
pushRegisterJob(subscription.InboxURL, jsonData)
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -7,20 +7,22 @@ import (
|
|||
)
|
||||
|
||||
func TestListFollows(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := followCmdInit()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
relayState.RedisClient.HMSet("relay:pending:example.com", map[string]interface{}{
|
||||
"inbox_url": "https://example.com/inbox",
|
||||
"activity_id": "https://example.com/UUID",
|
||||
"type": "Follow",
|
||||
"actor": "https://example.com/user/example",
|
||||
"object": "https://" + hostname.Host + "/actor",
|
||||
"object": "https://" + globalConfig.ServerHostname().Host + "/actor",
|
||||
})
|
||||
|
||||
app.SetArgs([]string{"follow", "list"})
|
||||
app.SetArgs([]string{"list"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
|
@ -29,25 +31,24 @@ example.com
|
|||
Total : 1
|
||||
`
|
||||
if output != valid {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestAcceptFollow(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := followCmdInit()
|
||||
|
||||
relayState.RedisClient.HMSet("relay:pending:example.com", map[string]interface{}{
|
||||
"inbox_url": "https://example.com/inbox",
|
||||
"activity_id": "https://example.com/UUID",
|
||||
"type": "Follow",
|
||||
"actor": "https://example.com/user/example",
|
||||
"object": "https://" + hostname.Host + "/actor",
|
||||
"object": "https://" + globalConfig.ServerHostname().Host + "/actor",
|
||||
})
|
||||
|
||||
app.SetArgs([]string{"follow", "accept", "example.com"})
|
||||
app.SetArgs([]string{"accept", "example.com"})
|
||||
app.Execute()
|
||||
|
||||
valid, _ := relayState.RedisClient.Exists("relay:pending:example.com").Result()
|
||||
|
@ -59,23 +60,22 @@ func TestAcceptFollow(t *testing.T) {
|
|||
if valid != 1 {
|
||||
t.Fatalf("Not created subscription.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestRejectFollow(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := followCmdInit()
|
||||
|
||||
relayState.RedisClient.HMSet("relay:pending:example.com", map[string]interface{}{
|
||||
"inbox_url": "https://example.com/inbox",
|
||||
"activity_id": "https://example.com/UUID",
|
||||
"type": "Follow",
|
||||
"actor": "https://example.com/user/example",
|
||||
"object": "https://" + hostname.Host + "/actor",
|
||||
"object": "https://" + globalConfig.ServerHostname().Host + "/actor",
|
||||
})
|
||||
|
||||
app.SetArgs([]string{"follow", "reject", "example.com"})
|
||||
app.SetArgs([]string{"reject", "example.com"})
|
||||
app.Execute()
|
||||
|
||||
valid, _ := relayState.RedisClient.Exists("relay:pending:example.com").Result()
|
||||
|
@ -87,56 +87,50 @@ func TestRejectFollow(t *testing.T) {
|
|||
if valid != 0 {
|
||||
t.Fatalf("Created subscription.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestInvalidFollow(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := followCmdInit()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"follow", "accept", "unknown.tld"})
|
||||
app.SetArgs([]string{"accept", "unknown.tld"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != "Invalid domain [unknown.tld] given" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestInvalidRejectFollow(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
app := followCmdInit()
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
app.SetOutput(buffer)
|
||||
app.SetOut(buffer)
|
||||
|
||||
app.SetArgs([]string{"follow", "reject", "unknown.tld"})
|
||||
app.SetArgs([]string{"reject", "unknown.tld"})
|
||||
app.Execute()
|
||||
|
||||
output := buffer.String()
|
||||
if strings.Split(output, "\n")[0] != "Invalid domain [unknown.tld] given" {
|
||||
t.Fatalf("Invalid Responce.")
|
||||
t.Fatalf("Invalid Response.")
|
||||
}
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
}
|
||||
|
||||
func TestCreateUpdateActorActivity(t *testing.T) {
|
||||
app := buildNewCmd()
|
||||
app := configCmdInit()
|
||||
|
||||
app.SetArgs([]string{"config", "import", "--json", "../misc/exampleConfig.json"})
|
||||
app.SetArgs([]string{"import", "--json", "../misc/test/exampleConfig.json"})
|
||||
app.Execute()
|
||||
|
||||
app.SetArgs([]string{"follow", "update"})
|
||||
app.Execute()
|
||||
app = followCmdInit()
|
||||
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
app.SetArgs([]string{"update"})
|
||||
app.Execute()
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import state "github.com/yukimochi/Activity-Relay/State"
|
||||
import "github.com/yukimochi/Activity-Relay/models"
|
||||
|
||||
func contains(entries interface{}, finder string) bool {
|
||||
switch entry := entries.(type) {
|
||||
|
@ -12,7 +12,7 @@ func contains(entries interface{}, finder string) bool {
|
|||
return true
|
||||
}
|
||||
}
|
||||
case []state.Subscription:
|
||||
case []models.Subscription:
|
||||
for i := 0; i < len(entry); i++ {
|
||||
if entry[i].Domain == finder {
|
||||
return true
|
|
@ -1,4 +1,4 @@
|
|||
package main
|
||||
package control
|
||||
|
||||
import "testing"
|
||||
|
62
decode.go
62
decode.go
|
@ -1,62 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
|
||||
"github.com/yukimochi/httpsig"
|
||||
)
|
||||
|
||||
func decodeActivity(request *http.Request) (*activitypub.Activity, *activitypub.Actor, []byte, error) {
|
||||
request.Header.Set("Host", request.Host)
|
||||
dataLen, _ := strconv.Atoi(request.Header.Get("Content-Length"))
|
||||
body := make([]byte, dataLen)
|
||||
request.Body.Read(body)
|
||||
|
||||
// Verify HTTPSignature
|
||||
verifier, err := httpsig.NewVerifier(request)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
KeyID := verifier.KeyId()
|
||||
remoteActor := new(activitypub.Actor)
|
||||
err = remoteActor.RetrieveRemoteActor(KeyID, fmt.Sprintf("%s (golang net/http; Activity-Relay %s; %s)", viper.GetString("relay_servicename"), version, hostURL.Host), actorCache)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
PubKey, err := keyloader.ReadPublicKeyRSAfromString(remoteActor.PublicKey.PublicKeyPem)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
err = verifier.Verify(PubKey, httpsig.RSA_SHA256)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// Verify Digest
|
||||
givenDigest := request.Header.Get("Digest")
|
||||
hash := sha256.New()
|
||||
hash.Write(body)
|
||||
b := hash.Sum(nil)
|
||||
calcurateDigest := "SHA-256=" + base64.StdEncoding.EncodeToString(b)
|
||||
|
||||
if givenDigest != calcurateDigest {
|
||||
return nil, nil, nil, errors.New("Digest header is mismatch")
|
||||
}
|
||||
|
||||
var activity activitypub.Activity
|
||||
err = json.Unmarshal(body, &activity)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
return &activity, remoteActor, body, nil
|
||||
}
|
122
decode_test.go
122
decode_test.go
|
@ -1,122 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
)
|
||||
|
||||
func TestHandleInboxNoSignure(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
req, _ := http.NewRequest("POST", s.URL, nil)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 400 {
|
||||
t.Fatalf("Failed - StatusCode is not 400")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleInboxWithRemoteActor(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("./misc/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
req, _ := http.NewRequest("POST", s.URL+"/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Set("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Set("digest", "SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=")
|
||||
req.Header.Set("content-type", "application/activity+json")
|
||||
req.Header.Set("signature", `keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 202 {
|
||||
t.Fatalf("Failed - StatusCode is not 202")
|
||||
}
|
||||
|
||||
relayState.DelSubscription("innocent.yukimochi.io")
|
||||
}
|
||||
|
||||
func TestHandleInboxWithNotfoundRemoteActor(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("./misc/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
req, _ := http.NewRequest("POST", s.URL+"/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Set("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Set("digest", "SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=")
|
||||
req.Header.Set("content-type", "application/activity+json")
|
||||
req.Header.Set("signature", `keyId="https://innocent.yukimochi.io/users/admin#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 400 {
|
||||
t.Fatalf("Failed - StatusCode is not 400")
|
||||
}
|
||||
|
||||
relayState.DelSubscription("innocent.yukimochi.io")
|
||||
}
|
||||
|
||||
func TestHandleInboxInvalidDigestWithRemoteActor(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
relayState.AddSubscription(state.Subscription{
|
||||
Domain: "innocent.yukimochi.io",
|
||||
InboxURL: "https://innocent.yukimochi.io/inbox",
|
||||
})
|
||||
|
||||
file, _ := os.Open("./misc/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
req, _ := http.NewRequest("POST", s.URL+"/inbox", bytes.NewReader(body))
|
||||
req.Host = "relay.01.cloudgarage.yukimochi.io"
|
||||
req.Header.Set("date", "Sun, 23 Dec 2018 07:39:37 GMT")
|
||||
req.Header.Set("digest", "SHA-256=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
||||
req.Header.Set("content-type", "application/activity+json")
|
||||
req.Header.Set("signature", `keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="`)
|
||||
client := new(http.Client)
|
||||
r, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
if r.StatusCode != 400 {
|
||||
t.Fatalf("Failed - StatusCode is not 400")
|
||||
}
|
||||
|
||||
relayState.DelSubscription("innocent.yukimochi.io")
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package deliver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/RichardKnop/machinery/v1/log"
|
||||
"github.com/go-redis/redis"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
globalConfig *models.RelayConfig
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor models.Actor
|
||||
|
||||
redisClient *redis.Client
|
||||
machineryServer *machinery.Server
|
||||
httpClient *http.Client
|
||||
)
|
||||
|
||||
func relayActivity(args ...string) error {
|
||||
inboxURL := args[0]
|
||||
body := args[1]
|
||||
err := sendActivity(inboxURL, Actor.ID, []byte(body), globalConfig.ActorKey())
|
||||
if err != nil {
|
||||
domain, _ := url.Parse(inboxURL)
|
||||
evalScript := "local change = redis.call('HSETNX',KEYS[1], 'last_error', ARGV[1]); if change == 1 then redis.call('EXPIRE', KEYS[1], ARGV[2]) end;"
|
||||
redisClient.Eval(evalScript, []string{"relay:statistics:" + domain.Host}, err.Error(), 60).Result()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func registerActivity(args ...string) error {
|
||||
inboxURL := args[0]
|
||||
body := args[1]
|
||||
err := sendActivity(inboxURL, Actor.ID, []byte(body), globalConfig.ActorKey())
|
||||
return err
|
||||
}
|
||||
|
||||
func Entrypoint(g *models.RelayConfig, v string) error {
|
||||
var err error
|
||||
globalConfig = g
|
||||
version = v
|
||||
|
||||
err = initialize(globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = machineryServer.RegisterTask("register", registerActivity)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = machineryServer.RegisterTask("relay", relayActivity)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
workerID := uuid.NewV4()
|
||||
worker := machineryServer.NewWorker(workerID.String(), globalConfig.JobConcurrency())
|
||||
err = worker.Launch()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func initialize(globalConfig *models.RelayConfig) error {
|
||||
var err error
|
||||
|
||||
redisClient = globalConfig.RedisClient()
|
||||
|
||||
machineryServer, err = models.NewMachineryServer(globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpClient = &http.Client{Timeout: time.Duration(5) * time.Second}
|
||||
|
||||
Actor = models.NewActivityPubActorFromSelfKey(globalConfig)
|
||||
newNullLogger := NewNullLogger()
|
||||
log.DEBUG = newNullLogger
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
package deliver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -9,18 +10,35 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
viper.Set("actor_pem", "../misc/testKey.pem")
|
||||
viper.Set("relay_domain", "relay.yukimochi.example.org")
|
||||
initConfig()
|
||||
redisClient.FlushAll().Result()
|
||||
var err error
|
||||
|
||||
// Load Config
|
||||
testConfigPath := "../misc/test/config.yml"
|
||||
file, _ := os.Open(testConfigPath)
|
||||
defer file.Close()
|
||||
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
viper.Set("ACTOR_PEM", "../misc/test/testKey.pem")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
|
||||
globalConfig, err = models.NewRelayConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = initialize(globalConfig)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
redisClient.FlushAll().Result()
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
redisClient.FlushAll().Result()
|
||||
}
|
||||
|
||||
func TestRelayActivity(t *testing.T) {
|
||||
|
@ -38,7 +56,7 @@ func TestRelayActivity(t *testing.T) {
|
|||
|
||||
err := relayActivity(s.URL, "data")
|
||||
if err != nil {
|
||||
t.Fatal("Failed - Data transfar not collect")
|
||||
t.Fatal("Failed - Data transfer not collect")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +71,7 @@ func TestRelayActivityNoHost(t *testing.T) {
|
|||
t.Fatal("Failed - Error not reported.")
|
||||
}
|
||||
domain, _ := url.Parse("http://nohost.example.jp")
|
||||
data, err := redisClient.HGet("relay:statistics:"+domain.Host, "last_error").Result()
|
||||
data, _ := redisClient.HGet("relay:statistics:"+domain.Host, "last_error").Result()
|
||||
if data == "" {
|
||||
t.Fatal("Failed - Error not cached.")
|
||||
}
|
||||
|
@ -71,13 +89,13 @@ func TestRelayActivityResp500(t *testing.T) {
|
|||
t.Fatal("Failed - Error not reported.")
|
||||
}
|
||||
domain, _ := url.Parse(s.URL)
|
||||
data, err := redisClient.HGet("relay:statistics:"+domain.Host, "last_error").Result()
|
||||
data, _ := redisClient.HGet("relay:statistics:"+domain.Host, "last_error").Result()
|
||||
if data == "" {
|
||||
t.Fatal("Failed - Error not cached.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistorActivity(t *testing.T) {
|
||||
func TestRegisterActivity(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
data, _ := ioutil.ReadAll(r.Body)
|
||||
if string(data) != "data" || r.Header.Get("Content-Type") != "application/activity+json" {
|
||||
|
@ -90,32 +108,32 @@ func TestRegistorActivity(t *testing.T) {
|
|||
}))
|
||||
defer s.Close()
|
||||
|
||||
err := registorActivity(s.URL, "data")
|
||||
err := registerActivity(s.URL, "data")
|
||||
if err != nil {
|
||||
t.Fatal("Failed - Data transfar not collect")
|
||||
t.Fatal("Failed - Data transfer not collect")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistorActivityNoHost(t *testing.T) {
|
||||
func TestRegisterActivityNoHost(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
err := registorActivity("http://nohost.example.jp", "data")
|
||||
err := registerActivity("http://nohost.example.jp", "data")
|
||||
if err == nil {
|
||||
t.Fatal("Failed - Error not reported.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistorActivityResp500(t *testing.T) {
|
||||
func TestRegisterActivityResp500(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(500)
|
||||
w.Write(nil)
|
||||
}))
|
||||
defer s.Close()
|
||||
|
||||
err := registorActivity(s.URL, "data")
|
||||
err := registerActivity(s.URL, "data")
|
||||
if err == nil {
|
||||
t.Fatal("Failed - Error not reported.")
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package main
|
||||
package deliver
|
||||
|
||||
// NullLogger : Null logger for debug output
|
||||
type NullLogger struct {
|
||||
}
|
||||
|
||||
// NewNullLogger : Create Nulllogger
|
||||
// NewNullLogger : Create NullLogger
|
||||
func NewNullLogger() *NullLogger {
|
||||
var newNullLogger NullLogger
|
||||
return &newNullLogger
|
|
@ -0,0 +1,53 @@
|
|||
package deliver
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
"strings"
|
||||
|
||||
httpdate "github.com/Songmu/go-httpdate"
|
||||
"github.com/go-fed/httpsig"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// See https://github.com/mastodon/mastodon/pull/14556
|
||||
const ONEHOUR = 60 * 60
|
||||
|
||||
func appendSignature(request *http.Request, body *[]byte, KeyID string, privateKey *rsa.PrivateKey) error {
|
||||
request.Header.Set("Host", request.Host)
|
||||
request.Header.Set("(request-target)", fmt.Sprintf("%s %s", strings.ToLower(request.Method), request.URL.Path))
|
||||
|
||||
signer, _, err := httpsig.NewSigner([]httpsig.Algorithm{httpsig.RSA_SHA256}, httpsig.DigestSha256, []string{httpsig.RequestTarget, "Host", "Date", "Digest", "Content-Type"}, httpsig.Signature, ONEHOUR)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = signer.SignRequest(privateKey, KeyID, request, *body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sendActivity(inboxURL string, KeyID string, body []byte, privateKey *rsa.PrivateKey) error {
|
||||
req, _ := http.NewRequest("POST", inboxURL, bytes.NewBuffer(body))
|
||||
req.Header.Set("Content-Type", "application/activity+json")
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("%s (golang net/http; Activity-Relay %s; %s)", globalConfig.ServerServiceName(), version, globalConfig.ServerHostname().Host))
|
||||
req.Header.Set("Date", httpdate.Time2Str(time.Now()))
|
||||
appendSignature(req, &body, KeyID, privateKey)
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
logrus.Debug(inboxURL, " ", resp.StatusCode)
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return errors.New("Post " + inboxURL + ": " + resp.Status)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package deliver
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/pem"
|
||||
"github.com/Songmu/go-httpdate"
|
||||
"github.com/go-fed/httpsig"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func generatePublicKeyPEMString(publicKey *rsa.PublicKey) string {
|
||||
publicKeyByte := x509.MarshalPKCS1PublicKey(publicKey)
|
||||
publicKeyPem := pem.EncodeToMemory(
|
||||
&pem.Block{
|
||||
Type: "RSA PUBLIC KEY",
|
||||
Bytes: publicKeyByte,
|
||||
},
|
||||
)
|
||||
return string(publicKeyPem)
|
||||
}
|
||||
|
||||
func TestAppendSignature(t *testing.T) {
|
||||
file, _ := os.Open("../misc/test/create.json")
|
||||
body, _ := ioutil.ReadAll(file)
|
||||
req, _ := http.NewRequest("POST", "https://localhost", bytes.NewBuffer(body))
|
||||
req.Header.Set("Content-Type", "application/activity+json")
|
||||
req.Header.Set("Date", httpdate.Time2Str(time.Now()))
|
||||
appendSignature(req, &body, "https://innocent.yukimochi.io/users/YUKIMOCHI#main-key", globalConfig.ActorKey())
|
||||
|
||||
// Verify HTTPSignature
|
||||
verifier, err := httpsig.NewVerifier(req)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
err = verifier.Verify(globalConfig.ActorKey().Public(), httpsig.RSA_SHA256)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
|
||||
// Verify Digest
|
||||
givenDigest := req.Header.Get("Digest")
|
||||
hash := sha256.New()
|
||||
hash.Write(body)
|
||||
b := hash.Sum(nil)
|
||||
calculatedDigest := "SHA-256=" + base64.StdEncoding.EncodeToString(b)
|
||||
|
||||
if givenDigest != calculatedDigest {
|
||||
t.Fatalf("Failed - " + err.Error())
|
||||
}
|
||||
}
|
|
@ -3,35 +3,33 @@ services:
|
|||
redis:
|
||||
restart: always
|
||||
image: redis:alpine
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
volumes:
|
||||
- "./redisdata:/data"
|
||||
|
||||
worker:
|
||||
build: .
|
||||
image: yukimochi/activity-relay
|
||||
working_dir: /var/lib/relay
|
||||
restart: always
|
||||
init: true
|
||||
command: worker
|
||||
environment:
|
||||
- "ACTOR_PEM=/actor.pem"
|
||||
- "RELAY_DOMAIN=relay.toot.yukimochi.jp"
|
||||
- "RELAY_SERVICENAME=YUKIMOCHI Toot Relay Service"
|
||||
- "RELAY_BIND=0.0.0.0:8080"
|
||||
- "REDIS_URL=redis://redis:6379"
|
||||
command: relay worker
|
||||
volumes:
|
||||
- "./actor.pem:/actor.pem"
|
||||
# - "./config.yaml:/Activity-Relay/config.yaml"
|
||||
- "./actor.pem:/var/lib/relay/actor.pem"
|
||||
- "./config.yml:/var/lib/relay/config.yml"
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
server:
|
||||
build: .
|
||||
image: yukimochi/activity-relay
|
||||
working_dir: /var/lib/relay
|
||||
restart: always
|
||||
init: true
|
||||
command: server
|
||||
environment:
|
||||
- "ACTOR_PEM=/actor.pem"
|
||||
- "RELAY_DOMAIN=relay.toot.yukimochi.jp"
|
||||
- "RELAY_SERVICENAME=YUKIMOCHI Toot Relay Service"
|
||||
- "RELAY_BIND=0.0.0.0:8080"
|
||||
- "REDIS_URL=redis://redis:6379"
|
||||
command: relay server
|
||||
volumes:
|
||||
- "./actor.pem:/actor.pem"
|
||||
# - "./config.yaml:/Activity-Relay/config.yaml"
|
||||
- "./actor.pem:/var/lib/relay/actor.pem"
|
||||
- "./config.yml:/var/lib/relay/config.yml"
|
||||
depends_on:
|
||||
- redis
|
||||
|
|
78
go.mod
78
go.mod
|
@ -1,14 +1,80 @@
|
|||
module github.com/yukimochi/Activity-Relay
|
||||
|
||||
go 1.12
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/RichardKnop/machinery v1.6.4
|
||||
github.com/RichardKnop/machinery v1.10.0
|
||||
github.com/Songmu/go-httpdate v1.0.0
|
||||
github.com/go-redis/redis v6.15.2+incompatible
|
||||
github.com/go-fed/httpsig v1.1.0
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/spf13/cobra v0.0.4
|
||||
github.com/spf13/viper v1.4.0
|
||||
github.com/yukimochi/httpsig v0.1.3
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/spf13/viper v1.13.0
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.105.0 // indirect
|
||||
cloud.google.com/go/compute v1.12.1 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.1 // indirect
|
||||
cloud.google.com/go/iam v0.7.0 // indirect
|
||||
cloud.google.com/go/kms v1.6.0 // indirect
|
||||
cloud.google.com/go/pubsub v1.8.3 // indirect
|
||||
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
|
||||
github.com/aws/aws-sdk-go v1.35.35 // indirect
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/go-redis/redis/v8 v8.4.0 // indirect
|
||||
github.com/go-redsync/redsync/v4 v4.0.4 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.3 // indirect
|
||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/kelseyhightower/envconfig v1.4.0 // indirect
|
||||
github.com/klauspost/compress v1.11.3 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/streadway/amqp v1.0.0 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
|
||||
github.com/xdg/stringprep v1.0.0 // indirect
|
||||
go.mongodb.org/mongo-driver v1.4.3 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.opentelemetry.io/otel v0.14.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
|
||||
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
|
||||
golang.org/x/text v0.4.0 // indirect
|
||||
google.golang.org/api v0.102.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect
|
||||
google.golang.org/grpc v1.50.1 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
|
@ -0,0 +1,730 @@
|
|||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.71.0/go.mod h1:qZfY4Y7AEIQwG/fQYD3xrxLNkQZ0Xzf3HGeqCkA6LVM=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
|
||||
cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y=
|
||||
cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0=
|
||||
cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU=
|
||||
cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48=
|
||||
cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/iam v0.7.0 h1:k4MuwOsS7zGJJ+QfZ5vBK8SgHBAvYN/23BWsiihJ1vs=
|
||||
cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg=
|
||||
cloud.google.com/go/kms v1.6.0 h1:OWRZzrPmOZUzurjI2FBGtgY2mB1WaJkqhw6oIwSj0Yg=
|
||||
cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0=
|
||||
cloud.google.com/go/longrunning v0.1.1 h1:y50CXG4j0+qvEukslYFBCrzaXX0qpFbBzc3PchSu/LE=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/pubsub v1.8.3 h1:kl5QdIn98mYhX+G7OzdQ9W3SQ0XXdhHlTw0GHa723pI=
|
||||
cloud.google.com/go/pubsub v1.8.3/go.mod h1:m8NMRz5lt0YjbQQ40RjocDVRjgYyzyYpP6ix3dxwRno=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae h1:DcFpTQBYQ9Ct2d6sC7ol0/ynxc2pO1cpGUM+f4t5adg=
|
||||
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae/go.mod h1:rJJ84PyA/Wlmw1hO+xTzV2wsSUon6J5ktg0g8BF2PuU=
|
||||
github.com/RichardKnop/machinery v1.10.0 h1:fw2qkFY145N55pkoCFk27aJYBgIB97KVp9SLII7ykwk=
|
||||
github.com/RichardKnop/machinery v1.10.0/go.mod h1:BU4Cgsp2OpTy00OqVBkVjUJUlhchpUV8M83VHH6lCZY=
|
||||
github.com/Songmu/go-httpdate v1.0.0 h1:39S00oyg9q+kMso2ahhK4pvD4EXk4zQWzt/AMqGlH3o=
|
||||
github.com/Songmu/go-httpdate v1.0.0/go.mod h1:QPvdlIAR7M8UtklJx5CMOOCIq7hbx2QdxyEPvTF5QVs=
|
||||
github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=
|
||||
github.com/aws/aws-sdk-go v1.35.35 h1:o/EbgEcIPWga7GWhJhb3tiaxqk4/goTdo5YEMdnVxgE=
|
||||
github.com/aws/aws-sdk-go v1.35.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/go-fed/httpsig v0.1.1-0.20200204213531-0ef28562fabe h1:U71giCx5NjRn4Lb71UuprPHqhjxGv3Jqonb9fgcaJH8=
|
||||
github.com/go-fed/httpsig v0.1.1-0.20200204213531-0ef28562fabe/go.mod h1:T56HUNYZUQ1AGUzhAYPugZfp36sKApVnGBgKlIY+aIE=
|
||||
github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI=
|
||||
github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
|
||||
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4=
|
||||
github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
|
||||
github.com/go-redis/redis/v8 v8.1.1/go.mod h1:ysgGY09J/QeDYbu3HikWEIPCwaeOkuNoTgKayTEaEOw=
|
||||
github.com/go-redis/redis/v8 v8.4.0 h1:J5NCReIgh3QgUJu398hUncxDExN4gMOHI11NVbVicGQ=
|
||||
github.com/go-redis/redis/v8 v8.4.0/go.mod h1:A1tbYoHSa1fXwN+//ljcCYYJeLmVrwL9hbQN45Jdy0M=
|
||||
github.com/go-redsync/redsync/v4 v4.0.4 h1:ru0qG+VCefaZSx3a5ADmlKZXkNdgeeYWIuymDu/tzV8=
|
||||
github.com/go-redsync/redsync/v4 v4.0.4/go.mod h1:QBOJAs1k8O6Eyrre4a++pxQgHe5eQ+HF56KuTVv+8Bs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
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/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
|
||||
github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=
|
||||
github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=
|
||||
github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
|
||||
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
|
||||
github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs=
|
||||
github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
|
||||
github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=
|
||||
github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk=
|
||||
github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28=
|
||||
github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo=
|
||||
github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk=
|
||||
github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw=
|
||||
github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360=
|
||||
github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg=
|
||||
github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE=
|
||||
github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8=
|
||||
github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
|
||||
github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=
|
||||
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
|
||||
github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=
|
||||
github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
|
||||
github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
|
||||
github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
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/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||
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/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU=
|
||||
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
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/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
|
||||
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
|
||||
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
|
||||
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
||||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc=
|
||||
github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
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/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
|
||||
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
|
||||
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M=
|
||||
github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.10.3 h1:gph6h/qe9GSUw1NhH1gp+qb+h8rXD8Cy60Z32Qw3ELA=
|
||||
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
|
||||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=
|
||||
github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo=
|
||||
github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo=
|
||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU=
|
||||
github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw=
|
||||
github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=
|
||||
github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
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.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
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/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
|
||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
|
||||
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
|
||||
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
|
||||
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
|
||||
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
||||
github.com/xdg/stringprep v1.0.0 h1:d9X0esnoa3dFsV0FG35rAT0RIhYFlPq7MiP+DW89La0=
|
||||
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.mongodb.org/mongo-driver v1.4.3 h1:moga+uhicpVshTyaqY9L23E6QqwcHRUv1sqyOsoyOO8=
|
||||
go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
|
||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
||||
go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0=
|
||||
go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ=
|
||||
go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw=
|
||||
golang.org/x/crypto v0.0.0-20180527072434-ab813273cd59/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/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-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
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-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201026091529-146b70c837a4/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU=
|
||||
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk=
|
||||
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||
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-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180525142821-c11f84a56e43/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201030143252-cf7a54d06671/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201125231158-b5590deeca9b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.34.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
||||
google.golang.org/api v0.102.0 h1:JxJl2qQ85fRMPNvlZY/enexbxpCjLwGhZUtgfGeQ51I=
|
||||
google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201030142918-24207fddd1c3/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo=
|
||||
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
|
||||
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
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/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
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=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
225
main.go
225
main.go
|
@ -1,105 +1,154 @@
|
|||
/*
|
||||
Yet another powerful customizable ActivityPub relay server written in Go.
|
||||
|
||||
Run Activity-Relay
|
||||
|
||||
API Server
|
||||
./Activity-Relay --config /path/to/config.yml server
|
||||
Job Worker
|
||||
./Activity-Relay --config /path/to/config.yml worker
|
||||
CLI Management Utility
|
||||
./Activity-Relay --config /path/to/config.yml control
|
||||
|
||||
Config
|
||||
|
||||
YAML Format
|
||||
ACTOR_PEM: /var/lib/relay/actor.pem
|
||||
REDIS_URL: redis://localhost:6379
|
||||
RELAY_BIND: 0.0.0.0:8080
|
||||
RELAY_DOMAIN: relay.toot.yukimochi.jp
|
||||
RELAY_SERVICENAME: YUKIMOCHI Toot Relay Service
|
||||
JOB_CONCURRENCY: 50
|
||||
RELAY_SUMMARY: |
|
||||
YUKIMOCHI Toot Relay Service is Running by Activity-Relay
|
||||
RELAY_ICON: https://example.com/example_icon.png
|
||||
RELAY_IMAGE: https://example.com/example_image.png
|
||||
Environment Variable
|
||||
|
||||
This is Optional : When config file not exist, use environment variables.
|
||||
- ACTOR_PEM
|
||||
- REDIS_URL
|
||||
- RELAY_BIND
|
||||
- RELAY_DOMAIN
|
||||
- RELAY_SERVICENAME
|
||||
- JOB_CONCURRENCY
|
||||
- RELAY_SUMMARY
|
||||
- RELAY_ICON
|
||||
- RELAY_IMAGE
|
||||
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"os"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/RichardKnop/machinery/v1/config"
|
||||
"github.com/go-redis/redis"
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
|
||||
state "github.com/yukimochi/Activity-Relay/State"
|
||||
"github.com/yukimochi/Activity-Relay/api"
|
||||
"github.com/yukimochi/Activity-Relay/control"
|
||||
"github.com/yukimochi/Activity-Relay/deliver"
|
||||
"github.com/yukimochi/Activity-Relay/models"
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
verbose bool
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor activitypub.Actor
|
||||
|
||||
// WebfingerResource : Relay's Webfinger resource
|
||||
WebfingerResource activitypub.WebfingerResource
|
||||
|
||||
hostURL *url.URL
|
||||
hostPrivatekey *rsa.PrivateKey
|
||||
relayState state.RelayState
|
||||
machineryServer *machinery.Server
|
||||
actorCache *cache.Cache
|
||||
globalConfig *models.RelayConfig
|
||||
)
|
||||
|
||||
func initConfig() {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath(".")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
fmt.Println("Config file is not exists. Use environment variables.")
|
||||
viper.BindEnv("actor_pem")
|
||||
viper.BindEnv("redis_url")
|
||||
viper.BindEnv("relay_bind")
|
||||
viper.BindEnv("relay_domain")
|
||||
viper.BindEnv("relay_servicename")
|
||||
} else {
|
||||
Actor.Summary = viper.GetString("relay_summary")
|
||||
Actor.Icon = activitypub.Image{URL: viper.GetString("relay_icon")}
|
||||
Actor.Image = activitypub.Image{URL: viper.GetString("relay_image")}
|
||||
}
|
||||
Actor.Name = viper.GetString("relay_servicename")
|
||||
|
||||
hostURL, _ = url.Parse("https://" + viper.GetString("relay_domain"))
|
||||
hostPrivatekey, _ = keyloader.ReadPrivateKeyRSAfromPath(viper.GetString("actor_pem"))
|
||||
redisOption, err := redis.ParseURL(viper.GetString("redis_url"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
redisClient := redis.NewClient(redisOption)
|
||||
relayState = state.NewState(redisClient)
|
||||
machineryConfig := &config.Config{
|
||||
Broker: viper.GetString("redis_url"),
|
||||
DefaultQueue: "relay",
|
||||
ResultBackend: viper.GetString("redis_url"),
|
||||
ResultsExpireIn: 5,
|
||||
}
|
||||
machineryServer, err = machinery.NewServer(machineryConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Actor.GenerateSelfKey(hostURL, &hostPrivatekey.PublicKey)
|
||||
actorCache = cache.New(5*time.Minute, 10*time.Minute)
|
||||
WebfingerResource.GenerateFromActor(hostURL, &Actor)
|
||||
|
||||
fmt.Println("Welcome to YUKIMOCHI Activity-Relay [Server]", version)
|
||||
fmt.Println(" - Configrations")
|
||||
fmt.Println("RELAY DOMAIN : ", hostURL.Host)
|
||||
fmt.Println("REDIS URL : ", viper.GetString("redis_url"))
|
||||
fmt.Println("BIND ADDRESS : ", viper.GetString("relay_bind"))
|
||||
fmt.Println(" - Blocked Domain")
|
||||
domains, _ := redisClient.HKeys("relay:config:blockedDomain").Result()
|
||||
for _, domain := range domains {
|
||||
fmt.Println(domain)
|
||||
}
|
||||
fmt.Println(" - Limited Domain")
|
||||
domains, _ = redisClient.HKeys("relay:config:limitedDomain").Result()
|
||||
for _, domain := range domains {
|
||||
fmt.Println(domain)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Load Config
|
||||
initConfig()
|
||||
|
||||
http.HandleFunc("/.well-known/webfinger", handleWebfinger)
|
||||
http.HandleFunc("/actor", handleActor)
|
||||
http.HandleFunc("/inbox", func(w http.ResponseWriter, r *http.Request) {
|
||||
handleInbox(w, r, decodeActivity)
|
||||
logrus.SetFormatter(&logrus.TextFormatter{
|
||||
ForceColors: true,
|
||||
})
|
||||
|
||||
http.ListenAndServe(viper.GetString("relay_bind"), nil)
|
||||
var app = buildCommand()
|
||||
app.PersistentFlags().StringP("config", "c", "config.yml", "Path of config file.")
|
||||
app.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Show debug log in stdout.")
|
||||
|
||||
app.Execute()
|
||||
}
|
||||
|
||||
func buildCommand() *cobra.Command {
|
||||
var server = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Activity-Relay API Server",
|
||||
Long: "Activity-Relay API Server is providing WebFinger API, ActivityPub inbox",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
initConfig(cmd)
|
||||
fmt.Println(globalConfig.DumpWelcomeMessage("API Server", version))
|
||||
err := api.Entrypoint(globalConfig, version)
|
||||
if err != nil {
|
||||
logrus.Fatal(err.Error())
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var worker = &cobra.Command{
|
||||
Use: "worker",
|
||||
Short: "Activity-Relay Job Worker",
|
||||
Long: "Activity-Relay Job Worker is providing ActivityPub Activity deliverer",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
initConfig(cmd)
|
||||
fmt.Println(globalConfig.DumpWelcomeMessage("Job Worker", version))
|
||||
err := deliver.Entrypoint(globalConfig, version)
|
||||
if err != nil {
|
||||
logrus.Fatal(err.Error())
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var command = &cobra.Command{
|
||||
Use: "control",
|
||||
Short: "Activity-Relay CLI",
|
||||
Long: "Activity-Relay CLI Management Utility",
|
||||
}
|
||||
control.BuildCommand(command)
|
||||
|
||||
var app = &cobra.Command{
|
||||
Short: "YUKIMOCHI Activity-Relay",
|
||||
Long: "YUKIMOCHI Activity-Relay - ActivityPub Relay Server",
|
||||
}
|
||||
app.AddCommand(server)
|
||||
app.AddCommand(worker)
|
||||
app.AddCommand(command)
|
||||
|
||||
return app
|
||||
}
|
||||
|
||||
func initConfig(cmd *cobra.Command) {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
fmt.Println("DEBUG VIEW")
|
||||
}
|
||||
|
||||
configPath := cmd.Flag("config").Value.String()
|
||||
file, err := os.Open(configPath)
|
||||
defer file.Close()
|
||||
|
||||
if err == nil {
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
} else {
|
||||
logrus.Warn("Config file not exist. Use environment variables.")
|
||||
|
||||
viper.BindEnv("ACTOR_PEM")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
viper.BindEnv("RELAY_BIND")
|
||||
viper.BindEnv("RELAY_DOMAIN")
|
||||
viper.BindEnv("RELAY_SERVICENAME")
|
||||
viper.BindEnv("JOB_CONCURRENCY")
|
||||
viper.BindEnv("RELAY_SUMMARY")
|
||||
viper.BindEnv("RELAY_ICON")
|
||||
viper.BindEnv("RELAY_IMAGE")
|
||||
}
|
||||
|
||||
globalConfig, err = models.NewRelayConfig()
|
||||
if err != nil {
|
||||
logrus.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
|
19
main_test.go
19
main_test.go
|
@ -1,19 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
viper.Set("actor_pem", "misc/testKey.pem")
|
||||
viper.Set("relay_domain", "relay.yukimochi.example.org")
|
||||
initConfig()
|
||||
|
||||
// Load Config
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
# relay-api.service
|
||||
#
|
||||
# For using YUKIMOCHI Activity-Relay.
|
||||
#
|
||||
# See https://github.com/yukimochi/Activity-Relay/wiki for instructions.
|
||||
|
||||
[Unit]
|
||||
Description=YUKIMOCHI Activity-Relay API Server
|
||||
Documentation=https://github.com/yukimochi/Activity-Relay/wiki
|
||||
After=network.target network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=relay
|
||||
Group=relay
|
||||
ExecStart=/usr/bin/relay --config /var/lib/relay/config.yml server
|
||||
TimeoutStopSec=5s
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=512
|
||||
PrivateTmp=true
|
||||
ProtectSystem=full
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,25 @@
|
|||
# relay-worker.service
|
||||
#
|
||||
# For using YUKIMOCHI Activity-Relay.
|
||||
#
|
||||
# See https://github.com/yukimochi/Activity-Relay/wiki for instructions.
|
||||
|
||||
[Unit]
|
||||
Description=YUKIMOCHI Activity-Relay Job Worker
|
||||
Documentation=https://github.com/yukimochi/Activity-Relay/wiki
|
||||
After=network.target network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=relay
|
||||
Group=relay
|
||||
ExecStart=/usr/bin/relay --config /var/lib/relay/config.yml worker
|
||||
TimeoutStopSec=5s
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=512
|
||||
PrivateTmp=true
|
||||
ProtectSystem=full
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
17
misc/header
17
misc/header
|
@ -1,17 +0,0 @@
|
|||
map[User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)] Content-Length:[2248] Accept-Encoding:[gzip] Connection:[close] X-Real-Ip:[202.182.118.242] X-Forwarded-For:[202.182.118.242] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] Content-Type:[application/activity+json] Date:[Sun, 23 Dec 2018 07:39:37 GMT] Digest:[SHA-256=mxgIzbPwBuNYxmjhQeH0vWeEedQGqR1R7zMwR/XTfX8=] Signature:[keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="MhxXhL21RVp8VmALER2U/oJlWldJAB2COiU2QmwGopLD2pw1c32gQvg0PaBRHfMBBOsidZuRRnj43Kn488zW2xV3n3DYWcGscSh527/hhRzcpLVX2kBqbf/WeQzJmfJVuOX4SzivVhnnUB8PvlPj5LRHpw4n/ctMTq37strKDl9iZg9rej1op1YFJagDxm3iPzAhnv8lzO4RI9dstt2i/sN5EfjXai97oS7EgI//Kj1wJCRk9Pw1iTsGfPTkbk/aVZwDt7QGGvGDdO0JJjsCqtIyjojoyD9hFY9GzMqvTwVIYJrh54AUHq2i80veybaOBbCFcEaK0RpKoLs101r5Uw=="]]
|
||||
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation","toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","focalPoint":{"@container":"@list","@id":"toot:focalPoint"},"featured":{"@id":"toot:featured","@type":"@id"},"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}],"id":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289215743686309/activity","type":"Create","actor":"https://innocent.yukimochi.io/users/YUKIMOCHI","published":"2018-12-23T07:39:37Z","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://innocent.yukimochi.io/users/YUKIMOCHI/followers"],"object":{"id":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289215743686309","type":"Note","summary":null,"inReplyTo":null,"published":"2018-12-23T07:39:37Z","url":"https://innocent.yukimochi.io/@YUKIMOCHI/101289215743686309","attributedTo":"https://innocent.yukimochi.io/users/YUKIMOCHI","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://innocent.yukimochi.io/users/YUKIMOCHI/followers"],"sensitive":false,"atomUri":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289215743686309","inReplyToAtomUri":null,"conversation":"tag:innocent.yukimochi.io,2018-12-23:objectId=113387:objectType=Conversation","content":"\u003cp\u003eてすてす\u003c/p\u003e","contentMap":{"ja":"\u003cp\u003eてすてす\u003c/p\u003e"},"attachment":[],"tag":[]},"signature":{"type":"RsaSignature2017","creator":"https://innocent.yukimochi.io/users/YUKIMOCHI#main-key","created":"2018-12-23T07:39:37Z","signatureValue":"TvpvX96xZpAXorHCkoUdBRVq53geGvJjZtFt0971PO2AvqeHouHOVKKL9Q/WCH2raZdFnC8bsBPeWHZ+XVRxS/6poXyZ5sx+LrOEugng9+J0HwuI97GJFpcfltzXPvEKGyeScpGxQoVzbMwH5WO8jddEXA6Qxmr5LNleSEEamwB+ZQRab7Xm2KVkGkdPW/gA0n9sVdpPTjcayrDSIF7HZrUr7lMVfUsWJctpVs45YkIkn2GOdmkYmbbQ5Mg0B4bYKI06p9e7EQ0WiCmO+zHvCh6QSWWx1qZNWm3j10ia1gP/FKpEBLhZkBoC7TJxNe/6pW5L03yT7F72rf8Ztxb76A=="}}
|
||||
|
||||
map[Content-Length:[1694] Accept-Encoding:[gzip] Connection:[close] Content-Type:[application/activity+json] Date:[Sun, 23 Dec 2018 07:48:31 GMT] Signature:[keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="XCzIDqdA2SG1VQp5yNveHUL6OE0yrVrClMonMMUO+dFKsgZ+Z+7d+tRLSVKrp5WkQMzMaM48DGSUetX3hRZeRSLwGKFbYHSPafjTpUI11p+JPnPF268kGmYOne75FEoANPTRyurK7e7cZFK5Xo+O8+tpOXUE74+eTUxPxrSidc3w/JvGX6hfFVzjbKUqMZKp3Xo9uvypamZqSC4WAQHRJ5ibuymzhnNVU03Jx5M26kSPPZ8pz1hUdwCqmi0/DKPXLEIn+VHlyOccCULbcGrU334iC0FJJURlfAlQYkoUHeF8aL8soKQPh2XkiTj+mXdE31T/Pxy0XeyLgfM3e52Fgg=="] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] X-Real-Ip:[202.182.118.242] Digest:[SHA-256=M3C0pD195sMKhWkeXJW11+chE3mxV7bDB9sb/g9lE8g=] X-Forwarded-For:[202.182.118.242] User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)]]
|
||||
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation","toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","focalPoint":{"@container":"@list","@id":"toot:focalPoint"},"featured":{"@id":"toot:featured","@type":"@id"},"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}],"id":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289250732181320/activity","type":"Announce","actor":"https://innocent.yukimochi.io/users/YUKIMOCHI","published":"2018-12-23T07:48:31Z","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://innocent.yukimochi.io/users/YUKIMOCHI","https://innocent.yukimochi.io/users/YUKIMOCHI/followers"],"object":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289215743686309","atomUri":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289250732181320/activity","signature":{"type":"RsaSignature2017","creator":"https://innocent.yukimochi.io/users/YUKIMOCHI#main-key","created":"2018-12-23T07:48:31Z","signatureValue":"BV9zw6w0fESP03/DAY185Qk74FIOGDkuX5o1ASRK/OjAEdH2gm7wXQVZ5vYzjJo1AG6CJyNE/XFVdqCqakJCpzJ6QJcTmm+//hq7J9VFlkpIgIGUBUtOOaVe5lWTi+z+pN23jQ0dGnYyBMxihIVMbrSYh0IelgcyhMkRwwhLHWB8/AmOhnyK+VvFD+g99f3e92f72mD86lE2xZjoxXG/ErS56U75pKqp7OUSRo5yu8uG6vCPFoOqu6lrNSm4jAGUwHY82j4IpCElwdahDu3TM+frw+AnZUjlj7EJMbZQyYJ/C6nE5HsoMT13Ph5AJtJif03At5XYgVDv5Eesh10n1w=="}}
|
||||
|
||||
map[Digest:[SHA-256=1aObUKpTAdKZyH7b6D+SEcRDPTuukXb71uNGyRciD04=] X-Forwarded-For:[202.182.118.242] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] Accept-Encoding:[gzip] Connection:[close] Date:[Sun, 23 Dec 2018 07:50:53 GMT] Signature:[keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="pefvsRNMnKV0/qmxEXXChcLPjvQF0pPRgOy0/EKK0B+AR1ExoaFsSGUHNsfw/MlizpE6IvKG93k84JkpNwtPZqaO4QdCFu7UjOayAeZ1h7YmXGo0COnTs0Z5WxRDdr4t4NaCCoW441FhCp2lLJOnzn9N6Kh5+GK1A2+wwCQRqy7YYYm2QKGLoJ6sZlDk7DI8KWZVhHzvzykfCw7ehXUaQYZA56i8q6l6FbENNEnk6l3TZOWIAAlg+3b8WdCMVqNYvG7Q0ZUYF4oPSlVkO1jI5xxVDq/6pNjtqBicr59rKRmoMYHRsKUjZOrKDAHXpgiTbSni42rd89yuXobUliTZ9A=="] X-Real-Ip:[202.182.118.242] User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)] Content-Length:[1916] Content-Type:[application/activity+json]]
|
||||
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation","toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","focalPoint":{"@container":"@list","@id":"toot:focalPoint"},"featured":{"@id":"toot:featured","@type":"@id"},"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}],"id":"https://innocent.yukimochi.io/users/YUKIMOCHI#announces/101289250732181320/undo","type":"Undo","actor":"https://innocent.yukimochi.io/users/YUKIMOCHI","to":["https://www.w3.org/ns/activitystreams#Public"],"object":{"id":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289250732181320/activity","type":"Announce","actor":"https://innocent.yukimochi.io/users/YUKIMOCHI","published":"2018-12-23T07:48:31Z","to":["https://www.w3.org/ns/activitystreams#Public"],"cc":["https://innocent.yukimochi.io/users/YUKIMOCHI","https://innocent.yukimochi.io/users/YUKIMOCHI/followers"],"object":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289215743686309","atomUri":"https://innocent.yukimochi.io/users/YUKIMOCHI/statuses/101289250732181320/activity"},"signature":{"type":"RsaSignature2017","creator":"https://innocent.yukimochi.io/users/YUKIMOCHI#main-key","created":"2018-12-23T07:50:53Z","signatureValue":"mPq1BaRWwJGnoAKssfolfhRB/MTFhnZTbxi5IHFast+EvoYqjir/ZDgGJwVo07Zkrok6yLSESALolXzGOoteV+BC+Idmb1c8iWX52kZSKaPqFTOwDWI0tumtTACWnluK0WdGxgmFQxmhfkyO7iz9yka6FA0Gbn3dLfaMWmOCJUJwrDRdS7tlsXe2W3cGqQGpXrabKUol5jZv0BojUVEWiVzlrfVtVmE/38+mttydcMpPYw9WBNtomm3kHBDwU7FbszRigUAO3MOI1ABGb3Zi67mihDfC1RoWgxwn4ke2/z6bzxvy6g8Biy0cSjUbDSf3xHypKJGSU62Es+DdKCPpSQ=="}}
|
||||
|
||||
map[Connection:[close] Date:[Sun, 23 Dec 2018 07:53:13 GMT] Digest:[SHA-256=sVu5mw+OWfi86NmAWm6rs+VZhsRLwla+uJqeM/DxL1Y=] X-Real-Ip:[202.182.118.242] User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)] Content-Length:[403] Accept-Encoding:[gzip] X-Forwarded-For:[202.182.118.242] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] Content-Type:[application/activity+json] Signature:[keyId="https://innocent.yukimochi.io/users/mayaeh#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="fnUhNMp421FitTE9NNEzD27MkwjKwa0OJiDggZ6vCDTj8EKNdfu/kMut9RWfyKY6c7TkXEuTJC78x7pmO05WtLllwAcxqXOf3dNKuO4S5KlhI6K/NPxNT7JwyQgTvEUpxmL4334rfUkfj8kyPg2IPAru+ilA3LRApJiyvOzw0hR3t2+mtwRiMrWyAQjQbo2B44gMGbs39pD+vNFp5ASliwUhs+YVAFq9IGWG9JZ1JNhqPGCU7L2tY8++ctbyO1YBbahxu+gto5EZodFHiefupQjVRa0DfD2QORYmxB+R+EX+jZJazEa9iqKmlV5Qx4DylEvBnbqpQSKG3zcDHAhnxg=="]]
|
||||
{"@context":"https://www.w3.org/ns/activitystreams","id":"https://innocent.yukimochi.io/d4028c5c-a794-4dcf-b2a8-0eaa41a086a1","type":"Undo","actor":"https://innocent.yukimochi.io/users/mayaeh","object":{"id":"https://innocent.yukimochi.io/102e3bf7-8a15-42d1-9e99-590e8e436f8e","type":"Follow","actor":"https://innocent.yukimochi.io/users/mayaeh","object":"https://www.w3.org/ns/activitystreams#Public"}}
|
||||
|
||||
map[Content-Type:[application/activity+json] Date:[Sun, 23 Dec 2018 07:53:26 GMT] Signature:[keyId="https://innocent.yukimochi.io/users/mayaeh#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="wWoNIarha2rc6gMeesYl35xcsxpiZQ76iUQihZwAfa24QxOQsRjWaaspJuSPyuj2Gz3bZ3xixhD9/im2EtDG9++zf2Ww3nc05s5qeHX94E/5aUmMlkKbavkLjcIeOPoDZYGr4eOTrhEWnWbYElyVAb9cgNrPRwxCllGEynf9jsV+ByH2EfQzKDW5QpQzan4Z/91Un/8dtjBZRZ7+LpMpeIGAbqMBrNIkKogDAQEEELGPToAvXwM00CgSZR+FxA7+Gk3ST5shwiB2ij5hOWvYlDefe+zSUJVgnjYO0t7c3qi4mojzLM9BeQZI8K5jBN0O8WbAVzVY7RRtD8fSWT819w=="] X-Forwarded-For:[202.182.118.242] X-Real-Ip:[202.182.118.242] Digest:[SHA-256=okLYHQWxAJY1ELwOGKPKhOkEfbD4Hfds2bskdFdcfj0=] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)] Content-Length:[251] Accept-Encoding:[gzip] Connection:[close]]
|
||||
{"@context":"https://www.w3.org/ns/activitystreams","id":"https://innocent.yukimochi.io/be0802b1-8648-4598-b794-2ed19532100d","type":"Follow","actor":"https://innocent.yukimochi.io/users/mayaeh","object":"https://www.w3.org/ns/activitystreams#Public"}
|
||||
|
||||
map[Date:[Sun, 23 Dec 2018 07:57:33 GMT] Digest:[SHA-256=0LrPvX1QoMb03H+4bmkJ82qS1iR4Z8K33Rp4WLzHbt0=] Signature:[keyId="https://innocent.yukimochi.io/users/YUKIMOCHI#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="wD4fCoTpc2iUGy/J+7PYZ08tS6DVf7TCqY3dgwSlG8H4UMtmfT0e8BQV4uRlr/sQlEJflp3RBeWXGsz3Y+2NclxO0xoVcA5+N5F8V5k3Uf6U1dtddm2Y8iUbt8hxT9qcNFC56NRKqtl3Ecj8yA9qs0LbesqLGs+wIlNUZUQLK/fC6d20TeGZwPwrC1LHig6bps8qTNyIaiVcDck3QzOXcwwGOokroSGf9PpdaOSMimHTMFEHdjqxclrYysVBl9yNxSP5oSmdOM55OnNzfaRkPqeTh1NOsSLZ/tCFV1owP/47Lu6lAwsjMU4586qokuWLwGUSx4NSgJ6fSj4Azj+umQ=="] X-Forwarded-For:[202.182.118.242] X-Forwarded-Proto:[https] Host:[relay.01.cloudgarage.yukimochi.io] User-Agent:[http.rb/3.3.0 (Mastodon/2.6.5; +https://innocent.yukimochi.io/)] Accept-Encoding:[gzip] X-Real-Ip:[202.182.118.242] Content-Length:[1353] Connection:[close] Content-Type:[application/activity+json]]
|
||||
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation","toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","focalPoint":{"@container":"@list","@id":"toot:focalPoint"},"featured":{"@id":"toot:featured","@type":"@id"},"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}],"id":"https://innocent.yukimochi.io/5cfe3380-6cf0-4a1a-a4dd-283b96999a9e","type":"Follow","actor":"https://innocent.yukimochi.io/users/YUKIMOCHI","object":"https://relay.01.cloudgarage.yukimochi.io/actor","signature":{"type":"RsaSignature2017","creator":"https://innocent.yukimochi.io/users/YUKIMOCHI#main-key","created":"2018-12-23T07:57:33Z","signatureValue":"t61d9Y2FispoIXDIxJH1eOs0/GAkIkCnESQv9ganfTVvDqaS9+jgW7o2/P1jeITIfOapqJlYuko3XtcxaGPbR/V4pL19xM8qaSLP1HO9COwnqy+CuWD7PKZ/E0y6Dnm/PETrn72yxxLRh95lsY0iwsD+ClFyLr9PoIRsVAV98ng1G23sQvAA7unapUjJMIgCVtNa3nylWHopcvdGLG5kqXVoXIfYN4H8HwiNoMzU4336bNSc1UIclnGcAjbfZtXvS3rEuSHIwBHGxnXHr3bKmclm5cwYmDHzfuwkCIJduehRfdLnSP1JGQig1GM2qX+/UIC4uEiD1tTWBIV6vR1i8g=="}}
|
|
@ -0,0 +1 @@
|
|||
{"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","movedTo":{"@id":"as:movedTo","@type":"@id"},"Hashtag":"as:Hashtag","ostatus":"http://ostatus.org#","atomUri":"ostatus:atomUri","inReplyToAtomUri":"ostatus:inReplyToAtomUri","conversation":"ostatus:conversation","toot":"http://joinmastodon.org/ns#","Emoji":"toot:Emoji","focalPoint":{"@container":"@list","@id":"toot:focalPoint"},"featured":{"@id":"toot:featured","@type":"@id"},"schema":"http://schema.org#","PropertyValue":"schema:PropertyValue","value":"schema:value"}],"id":"https://innocent.yukimochi.io/users/YUKIMOCHI","type":"Application","following":"https://innocent.yukimochi.io/users/YUKIMOCHI/following","followers":"https://innocent.yukimochi.io/users/YUKIMOCHI/followers","inbox":"https://innocent.yukimochi.io/users/YUKIMOCHI/inbox","outbox":"https://innocent.yukimochi.io/users/YUKIMOCHI/outbox","featured":"https://innocent.yukimochi.io/users/YUKIMOCHI/collections/featured","preferredUsername":"YUKIMOCHI","name":"雪餅🌟","summary":"\u003cp\u003e実験鯖です。連合して痛い目に合っても自己責任です・・・?(COM3D2の無垢ちゃん、かわいいかわいい!!)\u003c/p\u003e","url":"https://innocent.yukimochi.io/@YUKIMOCHI","manuallyApprovesFollowers":false,"publicKey":{"id":"https://innocent.yukimochi.io/users/YUKIMOCHI#main-key","owner":"https://innocent.yukimochi.io/users/YUKIMOCHI","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzNxXtpYOLYtpTUCxJDTq\nokV++p35C8lV+UlA8XIj8i1t64fWCqT1ULmlDEyiL1gWHEOVlV45z9PsCtJ2b2lV\nRFVBdQ1AeNKmaaTuX7CYM3wtli2cQQUlGEwWh1sgAv/LeoKRP90sA6O9M8M9H6T4\nF2cVHAaEnDFwjBQKtk/Bt70+esSkbe1qsc7vmrkaONAZrNVy6JY70r2Tg2uv7I3K\ndBpau6Igt1g87odVTPIhIVec8vnBzJvrHM1zorzRK+kPGjjAQ5XvZhkZzvjSfkkg\nqN5jDQrjfoW53vCfIJlbinEdWkJtGrDAnN1PjYIvH1bkOVJLDGUAtRtkTuCqJHPf\nMQIDAQAB\n-----END PUBLIC KEY-----\n"},"tag":[],"attachment":[],"endpoints":{"sharedInbox":"https://innocent.yukimochi.io/inbox"},"icon":{"type":"Image","mediaType":"image/png","url":"https://media.innocent.yukimochi.io/innocent/accounts/avatars/000/000/001/original/9f015d132fa2ef58.png"},"image":{"type":"Image","mediaType":"image/png","url":"https://media.innocent.yukimochi.io/innocent/accounts/headers/000/000/001/original/81300f90185e4d38.png"}}
|
|
@ -0,0 +1,10 @@
|
|||
# ACTOR_PEM: FILL_WITH_EACH_TEST
|
||||
# REDIS_URL: FILL_WITH_EACH_TEST
|
||||
|
||||
RELAY_BIND: 0.0.0.0:8080
|
||||
RELAY_DOMAIN: relay.toot.yukimochi.jp
|
||||
RELAY_SERVICENAME: YUKIMOCHI Toot Relay Service
|
||||
JOB_CONCURRENCY: 50
|
||||
RELAY_SUMMARY: YUKIMOCHI Toot Relay Service is Running by Activity-Relay
|
||||
RELAY_ICON: https://example.com/example_icon.png
|
||||
RELAY_IMAGE: https://example.com/example_image.png
|
|
@ -0,0 +1,140 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/RichardKnop/machinery/v1/config"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// RelayConfig contains valid configuration.
|
||||
type RelayConfig struct {
|
||||
actorKey *rsa.PrivateKey
|
||||
domain *url.URL
|
||||
redisClient *redis.Client
|
||||
redisURL string
|
||||
serverBind string
|
||||
serviceName string
|
||||
serviceSummary string
|
||||
serviceIconURL *url.URL
|
||||
serviceImageURL *url.URL
|
||||
jobConcurrency int
|
||||
}
|
||||
|
||||
// NewRelayConfig create valid RelayConfig from viper configuration. If invalid configuration detected, return error.
|
||||
func NewRelayConfig() (*RelayConfig, error) {
|
||||
domain, err := url.ParseRequestURI("https://" + viper.GetString("RELAY_DOMAIN"))
|
||||
if err != nil {
|
||||
return nil, errors.New("RELAY_DOMAIN: " + err.Error())
|
||||
}
|
||||
|
||||
iconURL, err := url.ParseRequestURI(viper.GetString("RELAY_ICON"))
|
||||
if err != nil {
|
||||
logrus.Warn("RELAY_ICON: INVALID OR EMPTY. THIS COLUMN IS DISABLED.")
|
||||
iconURL = nil
|
||||
}
|
||||
|
||||
imageURL, err := url.ParseRequestURI(viper.GetString("RELAY_IMAGE"))
|
||||
if err != nil {
|
||||
logrus.Warn("RELAY_IMAGE: INVALID OR EMPTY. THIS COLUMN IS DISABLED.")
|
||||
imageURL = nil
|
||||
}
|
||||
|
||||
jobConcurrency := viper.GetInt("JOB_CONCURRENCY")
|
||||
if jobConcurrency < 1 {
|
||||
return nil, errors.New("JOB_CONCURRENCY IS 0 OR EMPTY. SHOULD BE MORE THAN 1")
|
||||
}
|
||||
|
||||
privateKey, err := readPrivateKeyRSA(viper.GetString("ACTOR_PEM"))
|
||||
if err != nil {
|
||||
return nil, errors.New("ACTOR_PEM: " + err.Error())
|
||||
}
|
||||
|
||||
redisURL := viper.GetString("REDIS_URL")
|
||||
redisOption, err := redis.ParseURL(redisURL)
|
||||
if err != nil {
|
||||
return nil, errors.New("REDIS_URL: " + err.Error())
|
||||
}
|
||||
redisClient := redis.NewClient(redisOption)
|
||||
err = redisClient.Ping().Err()
|
||||
if err != nil {
|
||||
return nil, errors.New("Redis Connection Test: " + err.Error())
|
||||
}
|
||||
|
||||
serverBind := viper.GetString("RELAY_BIND")
|
||||
|
||||
return &RelayConfig{
|
||||
actorKey: privateKey,
|
||||
domain: domain,
|
||||
redisClient: redisClient,
|
||||
redisURL: redisURL,
|
||||
serverBind: serverBind,
|
||||
serviceName: viper.GetString("RELAY_SERVICENAME"),
|
||||
serviceSummary: viper.GetString("RELAY_SUMMARY"),
|
||||
serviceIconURL: iconURL,
|
||||
serviceImageURL: imageURL,
|
||||
jobConcurrency: jobConcurrency,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ServerBind is API Server's bind interface definition.
|
||||
func (relayConfig *RelayConfig) ServerBind() string {
|
||||
return relayConfig.serverBind
|
||||
}
|
||||
|
||||
// ServerHostname is API Server's hostname definition.
|
||||
func (relayConfig *RelayConfig) ServerHostname() *url.URL {
|
||||
return relayConfig.domain
|
||||
}
|
||||
|
||||
// ServerServiceName is API Server's servername definition.
|
||||
func (relayConfig *RelayConfig) ServerServiceName() string {
|
||||
return relayConfig.serviceName
|
||||
}
|
||||
|
||||
// JobConcurrency is API Worker's jobConcurrency definition.
|
||||
func (relayConfig *RelayConfig) JobConcurrency() int {
|
||||
return relayConfig.jobConcurrency
|
||||
}
|
||||
|
||||
// ActorKey is API Worker's HTTPSignature private key.
|
||||
func (relayConfig *RelayConfig) ActorKey() *rsa.PrivateKey {
|
||||
return relayConfig.actorKey
|
||||
}
|
||||
|
||||
// RedisClient is return redis client from RelayConfig.
|
||||
func (relayConfig *RelayConfig) RedisClient() *redis.Client {
|
||||
return relayConfig.redisClient
|
||||
}
|
||||
|
||||
// DumpWelcomeMessage provide build and config information string.
|
||||
func (relayConfig *RelayConfig) DumpWelcomeMessage(moduleName string, version string) string {
|
||||
return fmt.Sprintf(`Welcome to YUKIMOCHI Activity-Relay %s - %s
|
||||
- Configuration
|
||||
RELAY NAME : %s
|
||||
RELAY DOMAIN : %s
|
||||
REDIS URL : %s
|
||||
BIND ADDRESS : %s
|
||||
JOB_CONCURRENCY : %s
|
||||
`, version, moduleName, relayConfig.serviceName, relayConfig.domain.Host, relayConfig.redisURL, relayConfig.serverBind, strconv.Itoa(relayConfig.jobConcurrency))
|
||||
}
|
||||
|
||||
// NewMachineryServer create Redis backed Machinery Server from RelayConfig.
|
||||
func NewMachineryServer(globalConfig *RelayConfig) (*machinery.Server, error) {
|
||||
cnf := &config.Config{
|
||||
Broker: globalConfig.redisURL,
|
||||
DefaultQueue: "relay",
|
||||
ResultBackend: globalConfig.redisURL,
|
||||
ResultsExpireIn: 1,
|
||||
}
|
||||
newServer, err := machinery.NewServer(cnf)
|
||||
|
||||
return newServer, err
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func TestNewRelayConfig(t *testing.T) {
|
||||
t.Run("success valid configuration", func(t *testing.T) {
|
||||
relayConfig, err := NewRelayConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if relayConfig.serverBind != "0.0.0.0:8080" {
|
||||
t.Error("Failed parse: RelayConfig.serverBind")
|
||||
}
|
||||
if relayConfig.domain.Host != "relay.toot.yukimochi.jp" {
|
||||
t.Error("Failed parse: RelayConfig.domain")
|
||||
}
|
||||
if relayConfig.serviceName != "YUKIMOCHI Toot Relay Service" {
|
||||
t.Error("Failed parse: RelayConfig.serviceName")
|
||||
}
|
||||
if relayConfig.serviceSummary != "YUKIMOCHI Toot Relay Service is Running by Activity-Relay" {
|
||||
t.Error("Failed parse: RelayConfig.serviceSummary")
|
||||
}
|
||||
if relayConfig.serviceIconURL.String() != "https://example.com/example_icon.png" {
|
||||
t.Error("Failed parse: RelayConfig.serviceIconURL")
|
||||
}
|
||||
if relayConfig.serviceImageURL.String() != "https://example.com/example_image.png" {
|
||||
t.Error("Failed parse: RelayConfig.serviceImageURL")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("fail invalid configuration", func(t *testing.T) {
|
||||
invalidConfig := map[string]string{
|
||||
"ACTOR_PEM@notFound": "../misc/test/notfound.pem",
|
||||
"ACTOR_PEM@invalidKey": "../misc/test/actor.dh.pem",
|
||||
"REDIS_URL@invalidURL": "",
|
||||
"REDIS_URL@unreachableHost": "redis://localhost:6380",
|
||||
}
|
||||
|
||||
for key, value := range invalidConfig {
|
||||
viperKey := strings.Split(key, "@")[0]
|
||||
valid := viper.GetString(viperKey)
|
||||
|
||||
viper.Set(viperKey, value)
|
||||
_, err := NewRelayConfig()
|
||||
if err == nil {
|
||||
t.Error("Failed catch error: " + key)
|
||||
}
|
||||
|
||||
viper.Set(viperKey, valid)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func createRelayConfig(t *testing.T) *RelayConfig {
|
||||
relayConfig, err := NewRelayConfig()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return relayConfig
|
||||
}
|
||||
|
||||
func TestRelayConfig_ServerBind(t *testing.T) {
|
||||
relayConfig := createRelayConfig(t)
|
||||
if relayConfig.ServerBind() != relayConfig.serverBind {
|
||||
t.Error("Failed accessor: ServerBind()")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRelayConfig_ServerHostname(t *testing.T) {
|
||||
relayConfig := createRelayConfig(t)
|
||||
if relayConfig.ServerHostname() != relayConfig.domain {
|
||||
t.Error("Failed accessor: ServerHostname()")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRelayConfig_DumpWelcomeMessage(t *testing.T) {
|
||||
relayConfig := createRelayConfig(t)
|
||||
w := relayConfig.DumpWelcomeMessage("Testing", "")
|
||||
|
||||
informations := map[string]string{
|
||||
"module NAME": "Testing",
|
||||
"RELAY NANE": relayConfig.serviceName,
|
||||
"RELAY DOMAIN": relayConfig.domain.Host,
|
||||
"REDIS URL": relayConfig.redisURL,
|
||||
"BIND ADDRESS": relayConfig.serverBind,
|
||||
}
|
||||
|
||||
for key, information := range informations {
|
||||
if !strings.Contains(w, information) {
|
||||
t.Error("Missed welcome message information: ", key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewMachineryServer(t *testing.T) {
|
||||
relayConfig := createRelayConfig(t)
|
||||
|
||||
_, err := NewMachineryServer(relayConfig)
|
||||
if err != nil {
|
||||
t.Error("Failed create machinery server: ", err)
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package activitypub
|
||||
package models
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
|
||||
)
|
||||
|
||||
// PublicKey : Activity Certificate.
|
||||
|
@ -42,12 +41,12 @@ type Actor struct {
|
|||
Inbox string `json:"inbox,omitempty"`
|
||||
Endpoints *Endpoints `json:"endpoints,omitempty"`
|
||||
PublicKey PublicKey `json:"publicKey,omitempty"`
|
||||
Icon Image `json:"icon,omitempty"`
|
||||
Image Image `json:"image,omitempty"`
|
||||
Icon *Image `json:"icon,omitempty"`
|
||||
Image *Image `json:"image,omitempty"`
|
||||
}
|
||||
|
||||
// GenerateSelfKey : Generate relay Actor from Publickey.
|
||||
func (actor *Actor) GenerateSelfKey(hostname *url.URL, publickey *rsa.PublicKey) {
|
||||
// GenerateSelfKey : Generate relay Actor from PublicKey.
|
||||
func (actor *Actor) GenerateSelfKey(hostname *url.URL, publicKey *rsa.PublicKey) {
|
||||
actor.Context = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
|
||||
actor.ID = hostname.String() + "/actor"
|
||||
actor.Type = "Service"
|
||||
|
@ -56,10 +55,48 @@ func (actor *Actor) GenerateSelfKey(hostname *url.URL, publickey *rsa.PublicKey)
|
|||
actor.PublicKey = PublicKey{
|
||||
hostname.String() + "/actor#main-key",
|
||||
hostname.String() + "/actor",
|
||||
keyloader.GeneratePublicKeyPEMString(publickey),
|
||||
generatePublicKeyPEMString(publicKey),
|
||||
}
|
||||
}
|
||||
|
||||
func NewActivityPubActorFromSelfKey(globalConfig *RelayConfig) Actor {
|
||||
hostname := globalConfig.domain.String()
|
||||
publicKey := &globalConfig.actorKey.PublicKey
|
||||
publicKeyPemString := generatePublicKeyPEMString(publicKey)
|
||||
|
||||
newActor := Actor{
|
||||
Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"},
|
||||
ID: hostname + "/actor",
|
||||
Type: "Service",
|
||||
Name: globalConfig.serviceName,
|
||||
PreferredUsername: "relay",
|
||||
Summary: globalConfig.serviceSummary,
|
||||
Inbox: hostname + "/inbox",
|
||||
PublicKey: struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
PublicKeyPem string `json:"publicKeyPem,omitempty"`
|
||||
}{
|
||||
ID: hostname + "/actor#main-key",
|
||||
Owner: hostname + "/actor",
|
||||
PublicKeyPem: publicKeyPemString,
|
||||
},
|
||||
}
|
||||
|
||||
if globalConfig.serviceIconURL != nil {
|
||||
newActor.Icon = &Image{
|
||||
URL: globalConfig.serviceIconURL.String(),
|
||||
}
|
||||
}
|
||||
if globalConfig.serviceImageURL != nil {
|
||||
newActor.Image = &Image{
|
||||
URL: globalConfig.serviceImageURL.String(),
|
||||
}
|
||||
}
|
||||
|
||||
return newActor
|
||||
}
|
||||
|
||||
// RetrieveRemoteActor : Retrieve Actor from remote instance.
|
||||
func (actor *Actor) RetrieveRemoteActor(url string, uaString string, cache *cache.Cache) error {
|
||||
var err error
|
||||
|
@ -82,6 +119,10 @@ func (actor *Actor) RetrieveRemoteActor(url string, uaString string, cache *cach
|
|||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return errors.New(resp.Status)
|
||||
}
|
||||
|
||||
data, _ := ioutil.ReadAll(resp.Body)
|
||||
err = json.Unmarshal(data, &actor)
|
||||
if err != nil {
|
||||
|
@ -102,19 +143,6 @@ type Activity struct {
|
|||
Cc []string `json:"cc,omitempty"`
|
||||
}
|
||||
|
||||
// GenerateFollowbackRequest : Generate follow response.
|
||||
func (activity *Activity) GenerateFollowbackRequest(host *url.URL) Activity {
|
||||
return Activity{
|
||||
[]string{"https://www.w3.org/ns/activitystreams"},
|
||||
host.String() + "/activities/" + uuid.NewV4().String(),
|
||||
host.String() + "/actor",
|
||||
"Follow",
|
||||
activity.Actor,
|
||||
[]string{activity.Actor},
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateResponse : Generate activity response.
|
||||
func (activity *Activity) GenerateResponse(host *url.URL, responseType string) Activity {
|
||||
return Activity{
|
||||
|
@ -123,7 +151,7 @@ func (activity *Activity) GenerateResponse(host *url.URL, responseType string) A
|
|||
host.String() + "/actor",
|
||||
responseType,
|
||||
&activity,
|
||||
[]string{activity.Actor},
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
@ -167,9 +195,9 @@ func (activity *Activity) NestedActivity() (*Activity, error) {
|
|||
}, nil
|
||||
}
|
||||
}
|
||||
return nil, errors.New("Can't assart type")
|
||||
return nil, errors.New("can't assert type")
|
||||
}
|
||||
return nil, errors.New("Can't assart id")
|
||||
return nil, errors.New("can't assert id")
|
||||
}
|
||||
|
||||
// ActivityObject : ActivityPub Activity.
|
||||
|
@ -207,10 +235,86 @@ type WebfingerResource struct {
|
|||
func (resource *WebfingerResource) GenerateFromActor(hostname *url.URL, actor *Actor) {
|
||||
resource.Subject = "acct:" + actor.PreferredUsername + "@" + hostname.Host
|
||||
resource.Links = []WebfingerLink{
|
||||
WebfingerLink{
|
||||
{
|
||||
"self",
|
||||
"application/activity+json",
|
||||
actor.ID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NodeinfoResources : Nodeinfo Resources.
|
||||
type NodeinfoResources struct {
|
||||
NodeinfoLinks NodeinfoLinks
|
||||
Nodeinfo Nodeinfo
|
||||
}
|
||||
|
||||
// NodeinfoLinks : Nodeinfo Link Resource.
|
||||
type NodeinfoLinks struct {
|
||||
Links []NodeinfoLink `json:"links"`
|
||||
}
|
||||
|
||||
// NodeinfoLink : Nodeinfo Link Resource.
|
||||
type NodeinfoLink struct {
|
||||
Rel string `json:"rel"`
|
||||
Href string `json:"href"`
|
||||
}
|
||||
|
||||
// Nodeinfo : Nodeinfo Resource.
|
||||
type Nodeinfo struct {
|
||||
Version string `json:"version"`
|
||||
Software NodeinfoSoftware `json:"software"`
|
||||
Protocols []string `json:"protocols"`
|
||||
Services NodeinfoServices `json:"services"`
|
||||
OpenRegistrations bool `json:"openRegistrations"`
|
||||
Usage NodeinfoUsage `json:"usage"`
|
||||
Metadata NodeinfoMetadata `json:"metadata"`
|
||||
}
|
||||
|
||||
// NodeinfoSoftware : NodeinfoSoftware Resource.
|
||||
type NodeinfoSoftware struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Repository string `json:"repository,omitempty"`
|
||||
}
|
||||
|
||||
// NodeinfoServices : NodeinfoSoftware Resource.
|
||||
type NodeinfoServices struct {
|
||||
Inbound []string `json:"inbound"`
|
||||
Outbound []string `json:"outbound"`
|
||||
}
|
||||
|
||||
// NodeinfoUsage : NodeinfoUsage Resource.
|
||||
type NodeinfoUsage struct {
|
||||
Users NodeinfoUsageUsers `json:"users"`
|
||||
}
|
||||
|
||||
// NodeinfoUsageUsers : NodeinfoUsageUsers Resource.
|
||||
type NodeinfoUsageUsers struct {
|
||||
Total int `json:"total"`
|
||||
ActiveMonth int `json:"activeMonth"`
|
||||
ActiveHalfyear int `json:"activeHalfyear"`
|
||||
}
|
||||
|
||||
// NodeinfoMetadata : NodeinfoMetadata Resource.
|
||||
type NodeinfoMetadata struct {
|
||||
}
|
||||
|
||||
// GenerateFromActor : Generate Webfinger resource from Actor.
|
||||
func (resource *NodeinfoResources) GenerateFromActor(hostname *url.URL, actor *Actor, serverVersion string) {
|
||||
resource.NodeinfoLinks.Links = []NodeinfoLink{
|
||||
{
|
||||
"http://nodeinfo.diaspora.software/ns/schema/2.1",
|
||||
"https://" + hostname.Host + "/nodeinfo/2.1",
|
||||
},
|
||||
}
|
||||
resource.Nodeinfo = Nodeinfo{
|
||||
"2.1",
|
||||
NodeinfoSoftware{"activity-relay", serverVersion, "https://github.com/yukimochi/Activity-Relay"},
|
||||
[]string{"activitypub"},
|
||||
NodeinfoServices{[]string{}, []string{}},
|
||||
true,
|
||||
NodeinfoUsage{NodeinfoUsageUsers{0, 0, 0}},
|
||||
NodeinfoMetadata{},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var globalConfig *RelayConfig
|
||||
var relayState RelayState
|
||||
var ch chan bool
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
|
||||
testConfigPath := "../misc/test/config.yml"
|
||||
file, _ := os.Open(testConfigPath)
|
||||
defer file.Close()
|
||||
|
||||
viper.SetConfigType("yaml")
|
||||
viper.ReadConfig(file)
|
||||
viper.Set("ACTOR_PEM", "../misc/test/testKey.pem")
|
||||
viper.BindEnv("REDIS_URL")
|
||||
|
||||
globalConfig, err = NewRelayConfig()
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
relayState = NewState(globalConfig.RedisClient(), true)
|
||||
ch = make(chan bool)
|
||||
relayState.ListenNotify(ch)
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package state
|
||||
package models
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Config : Enum for RelayConfig
|
||||
|
@ -18,18 +19,10 @@ const (
|
|||
CreateAsAnnounce
|
||||
)
|
||||
|
||||
// NewState : Create new RelayState instance with redis client
|
||||
func NewState(redisClient *redis.Client) RelayState {
|
||||
var config RelayState
|
||||
config.RedisClient = redisClient
|
||||
|
||||
config.Load()
|
||||
return config
|
||||
}
|
||||
|
||||
// RelayState : Store subscriptions and relay configrations
|
||||
// RelayState : Store subscriptions and relay configurations
|
||||
type RelayState struct {
|
||||
RedisClient *redis.Client
|
||||
notifiable bool
|
||||
|
||||
RelayConfig relayConfig `json:"relayConfig,omitempty"`
|
||||
LimitedDomains []string `json:"limitedDomains,omitempty"`
|
||||
|
@ -37,6 +30,35 @@ type RelayState struct {
|
|||
Subscriptions []Subscription `json:"subscriptions,omitempty"`
|
||||
}
|
||||
|
||||
// NewState : Create new RelayState instance with redis client
|
||||
func NewState(redisClient *redis.Client, notifiable bool) RelayState {
|
||||
var config RelayState
|
||||
config.RedisClient = redisClient
|
||||
config.notifiable = notifiable
|
||||
|
||||
config.Load()
|
||||
return config
|
||||
}
|
||||
|
||||
func (config *RelayState) ListenNotify(c chan<- bool) {
|
||||
_, err := config.RedisClient.Subscribe("relay_refresh").Receive()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ch := config.RedisClient.Subscribe("relay_refresh").Channel()
|
||||
|
||||
cNotify := c != nil
|
||||
go func() {
|
||||
for range ch {
|
||||
logrus.Info("Config refreshed from state changed notify.")
|
||||
config.Load()
|
||||
if cNotify {
|
||||
c <- true
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Load : Refrash content from redis
|
||||
func (config *RelayState) Load() {
|
||||
config.RelayConfig.load(config.RedisClient)
|
||||
|
@ -70,7 +92,7 @@ func (config *RelayState) Load() {
|
|||
config.Subscriptions = subscriptions
|
||||
}
|
||||
|
||||
// SetConfig : Set relay configration
|
||||
// SetConfig : Set relay configuration
|
||||
func (config *RelayState) SetConfig(key Config, value bool) {
|
||||
strValue := 0
|
||||
if value {
|
||||
|
@ -84,7 +106,8 @@ func (config *RelayState) SetConfig(key Config, value bool) {
|
|||
case CreateAsAnnounce:
|
||||
config.RedisClient.HSet("relay:config", "create_as_announce", strValue).Result()
|
||||
}
|
||||
config.Load()
|
||||
|
||||
config.refresh()
|
||||
}
|
||||
|
||||
// AddSubscription : Add new instance for subscription list
|
||||
|
@ -95,7 +118,7 @@ func (config *RelayState) AddSubscription(domain Subscription) {
|
|||
"actor_id": domain.ActorID,
|
||||
})
|
||||
|
||||
config.Load()
|
||||
config.refresh()
|
||||
}
|
||||
|
||||
// DelSubscription : Delete instance from subscription list
|
||||
|
@ -103,7 +126,7 @@ func (config *RelayState) DelSubscription(domain string) {
|
|||
config.RedisClient.Del("relay:subscription:" + domain).Result()
|
||||
config.RedisClient.Del("relay:pending:" + domain).Result()
|
||||
|
||||
config.Load()
|
||||
config.refresh()
|
||||
}
|
||||
|
||||
// SelectSubscription : Select instance from string
|
||||
|
@ -124,7 +147,7 @@ func (config *RelayState) SetBlockedDomain(domain string, value bool) {
|
|||
config.RedisClient.HDel("relay:config:blockedDomain", domain).Result()
|
||||
}
|
||||
|
||||
config.Load()
|
||||
config.refresh()
|
||||
}
|
||||
|
||||
// SetLimitedDomain : Set/Unset instance for limited domain
|
||||
|
@ -135,8 +158,16 @@ func (config *RelayState) SetLimitedDomain(domain string, value bool) {
|
|||
config.RedisClient.HDel("relay:config:limitedDomain", domain).Result()
|
||||
}
|
||||
|
||||
config.refresh()
|
||||
}
|
||||
|
||||
func (config *RelayState) refresh() {
|
||||
if config.notifiable {
|
||||
config.RedisClient.Publish("relay_refresh", "Config refreshing request.")
|
||||
} else {
|
||||
config.Load()
|
||||
}
|
||||
}
|
||||
|
||||
// Subscription : Instance subscription information
|
||||
type Subscription struct {
|
|
@ -0,0 +1,190 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoadEmpty(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
relayState.Load()
|
||||
|
||||
if relayState.RelayConfig.BlockService != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
if relayState.RelayConfig.CreateAsAnnounce != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
if relayState.RelayConfig.ManuallyAccept != false {
|
||||
t.Fatalf("Failed read config.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetConfig(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.SetConfig(BlockService, true)
|
||||
<-ch
|
||||
if relayState.RelayConfig.BlockService != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
relayState.SetConfig(CreateAsAnnounce, true)
|
||||
<-ch
|
||||
if relayState.RelayConfig.CreateAsAnnounce != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
relayState.SetConfig(ManuallyAccept, true)
|
||||
<-ch
|
||||
if relayState.RelayConfig.ManuallyAccept != true {
|
||||
t.Fatalf("Failed enable config.")
|
||||
}
|
||||
|
||||
relayState.SetConfig(BlockService, false)
|
||||
<-ch
|
||||
if relayState.RelayConfig.BlockService != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
relayState.SetConfig(CreateAsAnnounce, false)
|
||||
<-ch
|
||||
if relayState.RelayConfig.CreateAsAnnounce != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
relayState.SetConfig(ManuallyAccept, false)
|
||||
<-ch
|
||||
if relayState.RelayConfig.ManuallyAccept != false {
|
||||
t.Fatalf("Failed disable config.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTreatSubscriptionNotify(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(Subscription{
|
||||
Domain: "example.com",
|
||||
InboxURL: "https://example.com/inbox",
|
||||
})
|
||||
<-ch
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.Subscriptions {
|
||||
if domain.Domain == "example.com" && domain.InboxURL == "https://example.com/inbox" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
relayState.DelSubscription("example.com")
|
||||
<-ch
|
||||
|
||||
for _, domain := range relayState.Subscriptions {
|
||||
if domain.Domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectDomain(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
exampleSubscription := Subscription{
|
||||
Domain: "example.com",
|
||||
InboxURL: "https://example.com/inbox",
|
||||
}
|
||||
|
||||
relayState.AddSubscription(exampleSubscription)
|
||||
<-ch
|
||||
|
||||
subscription := relayState.SelectSubscription("example.com")
|
||||
if *subscription != exampleSubscription {
|
||||
t.Fatalf("Failed select domain.")
|
||||
}
|
||||
|
||||
subscription = relayState.SelectSubscription("example.org")
|
||||
if subscription != nil {
|
||||
t.Fatalf("Failed select domain.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlockedDomain(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.SetBlockedDomain("example.com", true)
|
||||
<-ch
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.BlockedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
relayState.SetBlockedDomain("example.com", false)
|
||||
<-ch
|
||||
|
||||
for _, domain := range relayState.BlockedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLimitedDomain(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.SetLimitedDomain("example.com", true)
|
||||
<-ch
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.LimitedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
|
||||
relayState.SetLimitedDomain("example.com", false)
|
||||
<-ch
|
||||
|
||||
for _, domain := range relayState.LimitedDomains {
|
||||
if domain == "example.com" {
|
||||
valid = false
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed write config.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadCompatibleSubscription(t *testing.T) {
|
||||
relayState.RedisClient.FlushAll().Result()
|
||||
|
||||
relayState.AddSubscription(Subscription{
|
||||
Domain: "example.com",
|
||||
InboxURL: "https://example.com/inbox",
|
||||
})
|
||||
|
||||
relayState.RedisClient.HDel("relay:subscription:example.com", "activity_id", "actor_id")
|
||||
relayState.Load()
|
||||
|
||||
valid := false
|
||||
for _, domain := range relayState.Subscriptions {
|
||||
if domain.Domain == "example.com" && domain.InboxURL == "https://example.com/inbox" {
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
t.Fatalf("Failed load compati config.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func ReadPublicKeyRSAFromString(pemString string) (*rsa.PublicKey, error) {
|
||||
pemByte := []byte(pemString)
|
||||
decoded, _ := pem.Decode(pemByte)
|
||||
defer func() {
|
||||
recover()
|
||||
}()
|
||||
keyInterface, err := x509.ParsePKIXPublicKey(decoded.Bytes)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
pub := keyInterface.(*rsa.PublicKey)
|
||||
return pub, nil
|
||||
}
|
||||
|
||||
func redisHGetOrCreateWithDefault(redisClient *redis.Client, key string, field string, defaultValue string) (string, error) {
|
||||
keyExist, err := redisClient.HExists(key, field).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if keyExist {
|
||||
value, err := redisClient.HGet(key, field).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return value, nil
|
||||
} else {
|
||||
_, err := redisClient.HSet(key, field, defaultValue).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return defaultValue, nil
|
||||
}
|
||||
}
|
||||
|
||||
func readPrivateKeyRSA(keyPath string) (*rsa.PrivateKey, error) {
|
||||
file, err := ioutil.ReadFile(keyPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
decoded, _ := pem.Decode(file)
|
||||
if decoded == nil {
|
||||
return nil, errors.New("ACTOR_PEM IS INVALID. FAILED TO READ")
|
||||
}
|
||||
privateKey, err := x509.ParsePKCS1PrivateKey(decoded.Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return privateKey, nil
|
||||
}
|
||||
|
||||
func generatePublicKeyPEMString(publicKey *rsa.PublicKey) string {
|
||||
publicKeyByte := x509.MarshalPKCS1PublicKey(publicKey)
|
||||
publicKeyPem := pem.EncodeToMemory(
|
||||
&pem.Block{
|
||||
Type: "RSA PUBLIC KEY",
|
||||
Bytes: publicKeyByte,
|
||||
},
|
||||
)
|
||||
return string(publicKeyPem)
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRedisHGetOrCreateWithDefault(t *testing.T) {
|
||||
relayConfig := createRelayConfig(t)
|
||||
|
||||
t.Run("Execute HGet when value exist", func(t *testing.T) {
|
||||
_, err := relayConfig.redisClient.HSet("gotest:redis:hget:or:create:with:default", "exist", "1").Result()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
value, err := redisHGetOrCreateWithDefault(relayConfig.redisClient, "gotest:redis:hget:or:create:with:default", "exist", "2")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if value != "1" {
|
||||
t.Error(errors.New("value is override by redisHGetOrCreateWithDefault"))
|
||||
}
|
||||
|
||||
_, err = relayConfig.redisClient.HDel("gotest:redis:hget:or:create:with:default", "exist").Result()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Execute HGet when value not exist", func(t *testing.T) {
|
||||
_, err := redisHGetOrCreateWithDefault(relayConfig.redisClient, "gotest:redis:hget:or:create:with:default", "not_exist", "2")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
value, err := relayConfig.redisClient.HGet("gotest:redis:hget:or:create:with:default", "not_exist").Result()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if value != "2" {
|
||||
t.Error(errors.New("redisHGetOrCreateWithDefault is not write default value successfully"))
|
||||
}
|
||||
|
||||
_, err = relayConfig.redisClient.HDel("gotest:redis:hget:or:create:with:default", "not_exist").Result()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
}
|
92
readme.md
92
readme.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Yet another powerful customizable ActivityPub relay server written in Go.
|
||||
|
||||
[![CircleCI](https://circleci.com/gh/yukimochi/Activity-Relay.svg?style=svg)](https://circleci.com/gh/yukimochi/Activity-Relay)
|
||||
[![GitHub Actions](https://github.com/yukimochi/activity-relay/workflows/Test/badge.svg)](https://github.com/yukimochi/Activity-Relay)
|
||||
[![codecov](https://codecov.io/gh/yukimochi/Activity-Relay/branch/master/graph/badge.svg)](https://codecov.io/gh/yukimochi/Activity-Relay)
|
||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fyukimochi%2FActivity-Relay.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fyukimochi%2FActivity-Relay?ref=badge_shield)
|
||||
|
||||
|
@ -11,43 +11,83 @@
|
|||
## Packages
|
||||
|
||||
- `github.com/yukimochi/Activity-Relay`
|
||||
- `github.com/yukimochi/Activity-Relay/worker`
|
||||
- `github.com/yukimochi/Activity-Relay/cli`
|
||||
- `github.com/yukimochi/Activity-Relay/api`
|
||||
- `github.com/yukimochi/Activity-Relay/deliver`
|
||||
- `github.com/yukimochi/Activity-Relay/control`
|
||||
- `github.com/yukimochi/Activity-Relay/models`
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Redis](https://github.com/antirez/redis)
|
||||
|
||||
## Installation Manual
|
||||
## Run
|
||||
|
||||
See [GitHub wiki](https://github.com/yukimochi/Activity-Relay/wiki)
|
||||
### API Server
|
||||
|
||||
## Configration
|
||||
|
||||
### `config.yml`
|
||||
|
||||
```yaml config.yml
|
||||
actor_pem: /actor.pem
|
||||
redis_url: redis://redis:6379
|
||||
|
||||
relay_bind: 0.0.0.0:8080
|
||||
relay_domain: relay.toot.yukimochi.jp
|
||||
relay_servicename: YUKIMOCHI Toot Relay Service
|
||||
# relay_summary: |
|
||||
|
||||
# relay_icon: https://
|
||||
# relay_image: https://
|
||||
```bash
|
||||
relay --config /path/to/config.yml server
|
||||
```
|
||||
|
||||
### `Environment Variable`
|
||||
### Job Worker
|
||||
|
||||
```bash
|
||||
relay --config /path/to/config.yml worker
|
||||
```
|
||||
|
||||
### CLI Management Utility
|
||||
|
||||
```bash
|
||||
relay --config /path/to/config.yml control
|
||||
```
|
||||
|
||||
## Config
|
||||
|
||||
### YAML Format
|
||||
|
||||
```yaml config.yml
|
||||
ACTOR_PEM: /var/lib/relay/actor.pem
|
||||
REDIS_URL: redis://redis:6379
|
||||
|
||||
RELAY_BIND: 0.0.0.0:8080
|
||||
RELAY_DOMAIN: relay.toot.yukimochi.jp
|
||||
RELAY_SERVICENAME: YUKIMOCHI Toot Relay Service
|
||||
JOB_CONCURRENCY: 50
|
||||
# RELAY_SUMMARY: |
|
||||
|
||||
# RELAY_ICON: https://
|
||||
# RELAY_IMAGE: https://
|
||||
```
|
||||
|
||||
### Environment Variable
|
||||
|
||||
This is **Optional** : When `config.yml` not exists, use environment variable.
|
||||
|
||||
- `ACTOR_PEM` (ex. `/actor.pem`)
|
||||
- `REDIS_URL` (ex. `redis://127.0.0.1:6379/0`)
|
||||
- `RELAY_BIND` (ex. `0.0.0.0:8080`)
|
||||
- `RELAY_DOMAIN` (ex. `relay.toot.yukimochi.jp`)
|
||||
- `RELAY_SERVICENAME` (ex. `YUKIMOCHI Toot Relay Service`)
|
||||
- ACTOR_PEM
|
||||
- REDIS_URL
|
||||
- RELAY_BIND
|
||||
- RELAY_DOMAIN
|
||||
- RELAY_SERVICENAME
|
||||
- JOB_CONCURRENCY
|
||||
- RELAY_SUMMARY
|
||||
- RELAY_ICON
|
||||
- RELAY_IMAGE
|
||||
|
||||
## [Document](https://github.com/yukimochi/Activity-Relay/wiki)
|
||||
|
||||
See [GitHub wiki](https://github.com/yukimochi/Activity-Relay/wiki) to build / install / manage relay.
|
||||
|
||||
## License
|
||||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fyukimochi%2FActivity-Relay.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fyukimochi%2FActivity-Relay?ref=badge_large)
|
||||
|
||||
## Project Sponsors
|
||||
|
||||
Thank you for your support.
|
||||
|
||||
### Monthly Donation
|
||||
|
||||
**[My Donator List](https://relay.toot.yukimochi.jp#patreon-list)**
|
||||
|
||||
#### Donation Platform
|
||||
- [Patreon](https://www.patreon.com/yukimochi)
|
||||
- [pixiv fanbox](https://yukimochi.fanbox.cc)
|
||||
- [fantia](https://fantia.jp/fanclubs/11264)
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
httpdate "github.com/Songmu/go-httpdate"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/yukimochi/httpsig"
|
||||
)
|
||||
|
||||
func appendSignature(request *http.Request, body *[]byte, KeyID string, publicKey *rsa.PrivateKey) error {
|
||||
hash := sha256.New()
|
||||
hash.Write(*body)
|
||||
b := hash.Sum(nil)
|
||||
request.Header.Set("Digest", "SHA-256="+base64.StdEncoding.EncodeToString(b))
|
||||
request.Header.Set("Host", request.Host)
|
||||
|
||||
signer, _, err := httpsig.NewSigner([]httpsig.Algorithm{httpsig.RSA_SHA256}, []string{httpsig.RequestTarget, "Host", "Date", "Digest", "Content-Type"}, httpsig.Signature)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = signer.SignRequest(publicKey, KeyID, request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sendActivity(inboxURL string, KeyID string, body []byte, publicKey *rsa.PrivateKey) error {
|
||||
req, _ := http.NewRequest("POST", inboxURL, bytes.NewBuffer(body))
|
||||
req.Header.Set("Content-Type", "application/activity+json")
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("%s (golang net/http; Activity-Relay %s; %s)", viper.GetString("relay_servicename"), version, hostURL.Host))
|
||||
req.Header.Set("Date", httpdate.Time2Str(time.Now()))
|
||||
appendSignature(req, &body, KeyID, publicKey)
|
||||
client := &http.Client{Timeout: time.Duration(5) * time.Second}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(inboxURL, resp.StatusCode)
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return errors.New("Post " + inboxURL + ": " + resp.Status)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
117
worker/worker.go
117
worker/worker.go
|
@ -1,117 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/RichardKnop/machinery/v1"
|
||||
"github.com/RichardKnop/machinery/v1/config"
|
||||
"github.com/RichardKnop/machinery/v1/log"
|
||||
"github.com/go-redis/redis"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/spf13/viper"
|
||||
activitypub "github.com/yukimochi/Activity-Relay/ActivityPub"
|
||||
keyloader "github.com/yukimochi/Activity-Relay/KeyLoader"
|
||||
)
|
||||
|
||||
var (
|
||||
version string
|
||||
|
||||
// Actor : Relay's Actor
|
||||
Actor activitypub.Actor
|
||||
|
||||
hostURL *url.URL
|
||||
hostPrivatekey *rsa.PrivateKey
|
||||
redisClient *redis.Client
|
||||
machineryServer *machinery.Server
|
||||
)
|
||||
|
||||
func relayActivity(args ...string) error {
|
||||
inboxURL := args[0]
|
||||
body := args[1]
|
||||
err := sendActivity(inboxURL, Actor.ID, []byte(body), hostPrivatekey)
|
||||
if err != nil {
|
||||
domain, _ := url.Parse(inboxURL)
|
||||
mod, _ := redisClient.HSetNX("relay:statistics:"+domain.Host, "last_error", err.Error()).Result()
|
||||
if mod {
|
||||
redisClient.Expire("relay:statistics:"+domain.Host, time.Duration(time.Minute))
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func registorActivity(args ...string) error {
|
||||
inboxURL := args[0]
|
||||
body := args[1]
|
||||
err := sendActivity(inboxURL, Actor.ID, []byte(body), hostPrivatekey)
|
||||
return err
|
||||
}
|
||||
|
||||
func initConfig() {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath(".")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
fmt.Println("Config file is not exists. Use environment variables.")
|
||||
viper.BindEnv("actor_pem")
|
||||
viper.BindEnv("redis_url")
|
||||
viper.BindEnv("relay_bind")
|
||||
viper.BindEnv("relay_domain")
|
||||
viper.BindEnv("relay_servicename")
|
||||
} else {
|
||||
Actor.Summary = viper.GetString("relay_summary")
|
||||
Actor.Icon = activitypub.Image{URL: viper.GetString("relay_icon")}
|
||||
Actor.Image = activitypub.Image{URL: viper.GetString("relay_image")}
|
||||
}
|
||||
Actor.Name = viper.GetString("relay_servicename")
|
||||
|
||||
hostURL, _ = url.Parse("https://" + viper.GetString("relay_domain"))
|
||||
hostPrivatekey, _ = keyloader.ReadPrivateKeyRSAfromPath(viper.GetString("actor_pem"))
|
||||
redisOption, err := redis.ParseURL(viper.GetString("redis_url"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
redisClient = redis.NewClient(redisOption)
|
||||
machineryConfig := &config.Config{
|
||||
Broker: viper.GetString("redis_url"),
|
||||
DefaultQueue: "relay",
|
||||
ResultBackend: viper.GetString("redis_url"),
|
||||
ResultsExpireIn: 5,
|
||||
}
|
||||
machineryServer, err = machinery.NewServer(machineryConfig)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Actor.GenerateSelfKey(hostURL, &hostPrivatekey.PublicKey)
|
||||
newNullLogger := NewNullLogger()
|
||||
log.DEBUG = newNullLogger
|
||||
|
||||
fmt.Println("Welcome to YUKIMOCHI Activity-Relay [Worker]", version)
|
||||
fmt.Println(" - Configrations")
|
||||
fmt.Println("RELAY DOMAIN : ", hostURL.Host)
|
||||
fmt.Println("REDIS URL : ", viper.GetString("redis_url"))
|
||||
}
|
||||
|
||||
func main() {
|
||||
initConfig()
|
||||
|
||||
err := machineryServer.RegisterTask("registor", registorActivity)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
err = machineryServer.RegisterTask("relay", relayActivity)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
workerID := uuid.NewV4()
|
||||
worker := machineryServer.NewWorker(workerID.String(), 200)
|
||||
err = worker.Launch()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue