Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit b9f452f

Browse files
committed
feat: new project layout #9 and implemented NIP-42 for broadcasting #5
1 parent cd37620 commit b9f452f

File tree

25 files changed

+547
-442
lines changed

25 files changed

+547
-442
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ VERSION=0.3.1
1010
REPLAY_TO_RELAYS=false
1111
RELAYS_TO_PUBLISH_TO=""
1212
DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
13+
DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
1314
MAX_EVENTS_TO_REPLAY=10
1415
ENABLE_AUTO_NIP05_REGISTRATION=false
1516
MAIN_DOMAIN_NAME=""

.goreleaser.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
builds:
22
- id: rsslay-linux
3+
main: ./cmd/rsslay
34
ldflags:
45
- -s -w -linkmode external -extldflags '-static' -X 'github.com/piraces/rsslay/pkg/version.BuildVersion={{.Version}}'
56
env:

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ COPY go.mod ./
66
COPY go.sum ./
77
RUN go mod download
88

9-
COPY *.go ./
10-
COPY assets/* ./assets/
11-
COPY templates/* ./templates/
12-
COPY schema.sql .
9+
COPY cmd/ ./cmd/
10+
COPY internal/ ./internal/
11+
COPY pkg/ ./pkg/
12+
COPY web/ ./web/
13+
COPY scripts/ ./scripts/
1314

1415
RUN apk add --no-cache build-base
1516

16-
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay
17+
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay cmd/rsslay/main.go
1718

1819
FROM alpine:latest
1920

@@ -31,6 +32,7 @@ ENV VERSION=0.3.1
3132
ENV REPLAY_TO_RELAYS=false
3233
ENV RELAYS_TO_PUBLISH_TO=""
3334
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
35+
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
3436
ENV MAX_EVENTS_TO_REPLAY=10
3537
ENV ENABLE_AUTO_NIP05_REGISTRATION=false
3638
ENV MAIN_DOMAIN_NAME=""

Dockerfile.fly

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ COPY go.mod ./
88
COPY go.sum ./
99
RUN go mod download
1010

11-
COPY *.go ./
12-
COPY assets/* ./assets/
13-
COPY templates/* ./templates/
14-
COPY schema.sql .
11+
COPY cmd/ ./cmd/
12+
COPY internal/ ./internal/
13+
COPY pkg/ ./pkg/
14+
COPY web/ ./web/
15+
COPY scripts/ ./scripts/
1516

1617
RUN apk add --no-cache build-base
1718

18-
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -tags osusergo,netgo -o /rsslay
19+
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -tags osusergo,netgo -o /rsslay cmd/rsslay/main.go
1920

2021
FROM alpine:latest
2122

@@ -33,6 +34,7 @@ ENV VERSION=0.3.1
3334
ENV REPLAY_TO_RELAYS=false
3435
ENV RELAYS_TO_PUBLISH_TO=""
3536
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
37+
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
3638
ENV MAX_EVENTS_TO_REPLAY=10
3739
ENV ENABLE_AUTO_NIP05_REGISTRATION=false
3840
ENV MAIN_DOMAIN_NAME=""

Dockerfile.railwayapp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ARG SECRET
77
ARG REPLAY_TO_RELAYS
88
ARG RELAYS_TO_PUBLISH_TO
99
ARG DEFAULT_WAIT_TIME_BETWEEN_BATCHES
10+
ARG DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE
1011
ARG MAX_EVENTS_TO_REPLAY
1112
ARG ENABLE_AUTO_NIP05_REGISTRATION
1213
ARG MAIN_DOMAIN_NAME
@@ -19,14 +20,15 @@ COPY go.mod ./
1920
COPY go.sum ./
2021
RUN go mod download
2122

22-
COPY *.go ./
23-
COPY assets/* ./assets/
24-
COPY templates/* ./templates/
25-
COPY schema.sql .
23+
COPY cmd/ ./cmd/
24+
COPY internal/ ./internal/
25+
COPY pkg/ ./pkg/
26+
COPY web/ ./web/
27+
COPY scripts/ ./scripts/
2628

2729
RUN apk add --no-cache build-base
2830

29-
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay
31+
RUN CGO_ENABLED=1 go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o /rsslay cmd/rsslay/main.go
3032

3133
FROM alpine:latest
3234

@@ -37,6 +39,7 @@ ARG SECRET
3739
ARG REPLAY_TO_RELAYS
3840
ARG RELAYS_TO_PUBLISH_TO
3941
ARG DEFAULT_WAIT_TIME_BETWEEN_BATCHES
42+
ARG DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE
4043
ARG MAX_EVENTS_TO_REPLAY
4144
ARG ENABLE_AUTO_NIP05_REGISTRATION
4245
ARG MAIN_DOMAIN_NAME
@@ -57,6 +60,7 @@ ENV VERSION=0.3.1
5760
ENV REPLAY_TO_RELAYS=false
5861
ENV RELAYS_TO_PUBLISH_TO=""
5962
ENV DEFAULT_WAIT_TIME_BETWEEN_BATCHES=60000
63+
ENV DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE=3000
6064
ENV MAX_EVENTS_TO_REPLAY=10
6165
ENV ENABLE_AUTO_NIP05_REGISTRATION="false"
6266
ENV MAIN_DOMAIN_NAME=""

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
relayer-rss-bridge: $(shell find . -name "*.go")
2-
CC=$$(which musl-gcc) go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o ./relayer-rss-bridge
2+
CC=$$(which musl-gcc) go build -ldflags="-s -w -linkmode external -extldflags '-static'" -o ./relayer-rss-bridge cmd/rsslay/main.go

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
[![Publish Docker image](https://github.com/piraces/rsslay/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/piraces/rsslay/actions/workflows/docker-publish.yml)
66
![Docker Hub](https://img.shields.io/docker/pulls/piraces/rsslay?logo=docker)
77

8+
[![Go Report Card](https://goreportcard.com/badge/github.com/piraces/rsslay)](https://goreportcard.com/report/github.com/piraces/rsslay)
9+
[![Go Reference](https://pkg.go.dev/badge/github.com/piraces/rsslay.svg)](https://pkg.go.dev/github.com/piraces/rsslay)
10+
811
**Relay that creates virtual nostr profiles for each RSS feed submitted**
912

1013
**Working relay: `wss://rsslay.nostr.moe`. Frontend available in [rsslay.nostr.moe](https://rsslay.nostr.moe).**
@@ -76,6 +79,7 @@ _**Note:** it will create a local database file to store the currently known RSS
7679
- `REPLAY_TO_RELAYS`: set to true if you want to send the fetched events to other relays defined in `RELAYS_TO_PUBLISH_TO` (default is false)
7780
- `RELAYS_TO_PUBLISH_TO`: string with relays separated by `,` to re-publish events to in format `wss://[URL],wss://[URL2]` where `URL` and `URL2` are URLs of valid relays (default is empty)
7881
- `DEFAULT_WAIT_TIME_BETWEEN_BATCHES`: default time to wait between sending batches of requests to other relays in milliseconds (default 60000, 60 seconds)
82+
- `DEFAULT_WAIT_TIME_FOR_RELAY_RESPONSE`: default time to wait for relay response for possible auth event in milliseconds (default is 3000, 3 seconds).
7983
- `MAX_EVENTS_TO_REPLAY`: maximum number of events to send to a relay in `RELAYS_TO_PUBLISH_TO` in a batch
8084
- `ENABLE_AUTO_NIP05_REGISTRATION`: enables [NIP-05](https://github.com/nostr-protocol/nips/blob/master/05.md) automatic registration for all feed profiles in the format `[URL]@[MAIN_DOMAIN_NAME]` where URL is the main URL for the feed and `MAIN_DOMAIN_NAME` the below environment variable (default `false`)
8185
- `MAIN_DOMAIN_NAME`: main domain name where this relay will be available (only for NIP-05 purposes if enabled with `ENABLE_AUTO_NIP05_REGISTRATION`)

0 commit comments

Comments
 (0)