Skip to content

Commit 48cb84a

Browse files
fearlessfeGrapeBaBa
authored andcommitted
fix: findNodes err and add build images ci
1 parent cc85bf6 commit 48cb84a

File tree

3 files changed

+52
-9
lines changed

3 files changed

+52
-9
lines changed

.github/workflows/image.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: shisui latest image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: write
17+
18+
env:
19+
REGISTRY: ghcr.io
20+
IMAGE_NAME: ${{ github.repository }}
21+
22+
jobs:
23+
push_image_to_github:
24+
name: Push Docker image to Github
25+
runs-on: ubuntu-latest
26+
permissions: write-all
27+
steps:
28+
- name: Check out the repo
29+
uses: actions/checkout@v4
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: .
41+
file: ./Dockerfile.portal
42+
push: true
43+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
FROM --platform=linux/amd64 golang:1.23 as builder
1+
FROM golang:1.23 as builder
22

33
WORKDIR /app
44

55
COPY . .
6-
RUN go env -w GOPROXY=https://goproxy.cn,direct
7-
# RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build ./cmd/shisui/main.go
6+
87
RUN make shisui
98

109

11-
FROM --platform=linux/amd64 ubuntu:22.04
10+
FROM ubuntu:22.04
1211

1312
COPY --from=builder /app/build/bin/shisui /usr/local/bin/app
1413

portalwire/portal_protocol.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,11 @@ func (p *PortalProtocol) setupDiscV5AndTable() error {
315315
}
316316

317317
cfg := discover.Config{
318-
PrivateKey: p.PrivateKey,
319-
NetRestrict: p.NetRestrict,
320-
Bootnodes: p.BootstrapNodes,
321-
Log: p.Log,
318+
PrivateKey: p.PrivateKey,
319+
NetRestrict: p.NetRestrict,
320+
Bootnodes: p.BootstrapNodes,
321+
Log: p.Log,
322+
NoFindnodeLivenessCheck: true,
322323
}
323324

324325
p.table, err = discover.NewTable(p, p.localNode.Database(), cfg)
@@ -970,7 +971,7 @@ func (p *PortalProtocol) handleFindNodes(fromAddr *net.UDPAddr, request *FindNod
970971
enrs := p.truncateNodes(nodes, maxPayloadSize, enrOverhead)
971972

972973
nodesMsg := &Nodes{
973-
Total: 1,
974+
Total: uint8(len(enrs)),
974975
Enrs: enrs,
975976
}
976977

0 commit comments

Comments
 (0)