tangled
alpha
login
or
join now
gbl08ma.com
/
didplcbft
24
fork
atom
A very experimental PLC implementation which uses BFT consensus for decentralization
24
fork
atom
overview
issues
pulls
pipelines
Reliably set User-Agent on requests to authoritative PLC
gbl08ma.com
1 month ago
92b8e6ce
9f40f718
verified
This commit was signed with the committer's
known signature
.
gbl08ma.com
SSH Key Fingerprint:
SHA256:SPYB6pdFx2f9Xq5OXiol0IqoLhhxmlCgkqfaB82rWBw=
+12
-2
2 changed files
expand all
collapse all
unified
split
abciapp
import.go
info.go
+4
-1
abciapp/import.go
···
113
113
q.Add("cursor", fmt.Sprint(cursor))
114
114
url.RawQuery = q.Encode()
115
115
116
116
+
header := http.Header{}
117
117
+
header.Set("User-Agent", SoftwareUserAgent)
116
118
c, _, err := websocket.Dial(ctx, url.String(), &websocket.DialOptions{
117
119
HTTPClient: a.client,
120
120
+
HTTPHeader: header,
118
121
})
119
122
if err != nil {
120
123
a.logger.Error("authoritative operations fetcher failed to dial websocket",
···
270
273
return nil, 0, stacktrace.Propagate(err, "")
271
274
}
272
275
273
273
-
req.Header.Set("User-Agent", "didplcbft")
276
276
+
req.Header.Set("User-Agent", SoftwareUserAgent)
274
277
275
278
requestCount := min(1000, maxCount-uint64(len(entries)))
276
279
+8
-1
abciapp/info.go
···
4
4
"context"
5
5
"encoding/json"
6
6
"errors"
7
7
+
"fmt"
7
8
"net/http"
8
9
"net/url"
10
10
+
"runtime"
9
11
"time"
10
12
11
13
abcitypes "github.com/cometbft/cometbft/abci/types"
···
15
17
"tangled.org/gbl08ma.com/didplcbft/transaction"
16
18
)
17
19
20
20
+
const SoftwareVersion = "0.1.2"
21
21
+
const SoftwareName = "didplcbft"
22
22
+
23
23
+
var SoftwareUserAgent = fmt.Sprintf("%s/%s (%s; %s)", SoftwareName, SoftwareVersion, runtime.GOOS, runtime.GOARCH)
24
24
+
18
25
// Info implements [types.Application].
19
26
func (d *DIDPLCApplication) Info(ctx context.Context, req *abcitypes.RequestInfo) (*abcitypes.ResponseInfo, error) {
20
27
return &abcitypes.ResponseInfo{
21
28
Data: "", // TODO some status report as JSON? Information about CometBFT itself can be obtained from RequestInfo
22
22
-
Version: "0.1.1",
29
29
+
Version: SoftwareVersion,
23
30
AppVersion: 0, // TODO, included in the header of every block. move these values to constants
24
31
LastBlockHeight: d.tree.Version(),
25
32
LastBlockAppHash: d.tree.Hash(),