Skip to content

Commit bb2287d

Browse files
TeoSlayerteovl
andauthored
fix(bindings): thread adminToken through PilotPolicySet (#14)
common's driver.PolicySet gained a third `adminToken string` parameter in v0.4.4. libpilot's `bindings.go` was still calling the old 2-arg form, so the whole CGO shim has been failing to build on main since 2026-06-06. Adds a fourth C argument (`adminToken *C.char`) to PilotPolicySet, mirroring the convention PilotBroadcast already follows. Empty strings are valid — the daemon side treats an absent token the same as "no admin auth attempted." This is a C ABI break, but the library has been uncompilable for three days; anyone embedding it can't be. Re-publishing as v0.x with the new symbol shape is the right call. go.mod tidy also bumps the sibling deps that drifted alongside: common 0.4.3 → 0.4.8 runtime 0.1.0 → 0.3.1 handshake 0.1.0 → 0.2.1 policy 0.1.0 → 0.2.2 trustedagents 0.1.0 → 0.2.3 Build + unit tests pass. Co-authored-by: Teodor Calin <teodor@vulturelabs.io>
1 parent 2e2208e commit bb2287d

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

bindings.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,12 +718,12 @@ func PilotPolicyGet(h C.uint64_t, networkID C.uint16_t) *C.char {
718718
}
719719

720720
//export PilotPolicySet
721-
func PilotPolicySet(h C.uint64_t, networkID C.uint16_t, policyJSON *C.char) *C.char {
721+
func PilotPolicySet(h C.uint64_t, networkID C.uint16_t, policyJSON *C.char, adminToken *C.char) *C.char {
722722
d, err := driverFromHandle(h)
723723
if err != nil {
724724
return errJSON(err)
725725
}
726-
r, err := d.PolicySet(uint16(networkID), []byte(C.GoString(policyJSON)))
726+
r, err := d.PolicySet(uint16(networkID), []byte(C.GoString(policyJSON)), C.GoString(adminToken))
727727
if err != nil {
728728
return errJSON(err)
729729
}

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ go 1.25.10
44

55
require (
66
github.com/TeoSlayer/pilotprotocol v1.10.5
7-
github.com/pilot-protocol/common v0.4.3
8-
github.com/pilot-protocol/runtime v0.1.0
7+
github.com/pilot-protocol/common v0.4.8
8+
github.com/pilot-protocol/runtime v0.3.1
99
)
1010

1111
require (
1212
github.com/coder/websocket v1.8.14 // indirect
1313
github.com/expr-lang/expr v1.17.8 // indirect
14-
github.com/pilot-protocol/handshake v0.1.0 // indirect
15-
github.com/pilot-protocol/policy v0.1.0 // indirect
16-
github.com/pilot-protocol/trustedagents v0.1.0 // indirect
14+
github.com/pilot-protocol/handshake v0.2.1 // indirect
15+
github.com/pilot-protocol/policy v0.2.2 // indirect
16+
github.com/pilot-protocol/trustedagents v0.2.3 // indirect
17+
golang.org/x/sys v0.45.0 // indirect
1718
)
1819

1920
replace github.com/TeoSlayer/pilotprotocol => ../web4

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9
22
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
33
github.com/expr-lang/expr v1.17.8 h1:W1loDTT+0PQf5YteHSTpju2qfUfNoBt4yw9+wOEU9VM=
44
github.com/expr-lang/expr v1.17.8/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
5+
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
6+
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=

0 commit comments

Comments
 (0)