Skip to content

Commit

Permalink
More scrubbing of malspelled names.
Browse files Browse the repository at this point in the history
The addition of a linter rules for ifid and trc has revealed a truckload more.
Some *cannot* be fixed as they are automatically derived from published
APIs and Protobufs.
  • Loading branch information
jiceatscion committed Jul 22, 2024
1 parent 3390178 commit c9cfa94
Show file tree
Hide file tree
Showing 31 changed files with 188 additions and 166 deletions.
2 changes: 1 addition & 1 deletion control/beaconing/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func interfaceInfos(topo topology.Topology) map[uint16]ifstate.InterfaceInfo {
IA: info.IA,
LinkType: info.LinkType,
InternalAddr: netip.MustParseAddrPort(info.InternalAddr.String()),
RemoteID: uint16(info.RemoteIFID),
RemoteID: uint16(info.RemoteIfID),
MTU: uint16(info.MTU),
}
}
Expand Down
2 changes: 1 addition & 1 deletion control/cmd/control/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ func adaptInterfaceMap(in map[common.IfIDType]topology.IFInfo) map[uint16]ifstat
IA: info.IA,
LinkType: info.LinkType,
InternalAddr: info.InternalAddr,
RemoteID: uint16(info.RemoteIFID),
RemoteID: uint16(info.RemoteIfID),
MTU: uint16(info.MTU),
}
}
Expand Down
18 changes: 11 additions & 7 deletions control/mgmtapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,22 +586,26 @@ func (s *Server) GetCa(w http.ResponseWriter, r *http.Request) {
}

// GetTrcs gets the trcs specified by it's params.
func (s *Server) GetTrcs(w http.ResponseWriter, r *http.Request, params GetTrcsParams) {
cppkiParams := cppkiapi.GetTrcsParams{
func (s *Server) GetTrcs(
w http.ResponseWriter,
r *http.Request,
params GetTrcsParams, // nolint - name from published API
) {
cppkiParams := cppkiapi.GetTrcsParams{ // nolint - name from published API
Isd: params.Isd,
All: params.All,
}
s.CPPKIServer.GetTrcs(w, r, cppkiParams)
s.CPPKIServer.GetTrcs(w, r, cppkiParams) // nolint - name from published API
}

// GetTrc gets the trc specified by it's isd base and serial.
func (s *Server) GetTrc(w http.ResponseWriter, r *http.Request, isd int, base int, serial int) {
s.CPPKIServer.GetTrc(w, r, isd, base, serial)
s.CPPKIServer.GetTrc(w, r, isd, base, serial) // nolint - name from published API
}

// GetTrcBlob gets the trc encoded pem blob.
func (s *Server) GetTrcBlob(w http.ResponseWriter, r *http.Request, isd int, base int, serial int) {
s.CPPKIServer.GetTrcBlob(w, r, isd, base, serial)
s.CPPKIServer.GetTrcBlob(w, r, isd, base, serial) // nolint - name from published API
}

// GetConfig is an indirection to the http handler.
Expand Down Expand Up @@ -663,12 +667,12 @@ func (s *Server) GetSigner(w http.ResponseWriter, r *http.Request) {
},
},
Expiration: p.Expiration,
TrcId: TRCID{
TrcId: TRCID{ // nolint - name from published API
BaseNumber: int(p.TRCID.Base),
Isd: int(p.TRCID.ISD),
SerialNumber: int(p.TRCID.Serial),
},
TrcInGracePeriod: p.InGrace,
TrcInGracePeriod: p.InGrace, // nolint - name from published API
}
enc := json.NewEncoder(w)
enc.SetIndent("", " ")
Expand Down
2 changes: 1 addition & 1 deletion control/trust/grpc/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ func chainsToResponse(chains [][]*x509.Certificate) *cppb.ChainsResponse {

func trcToResponse(trc cppki.SignedTRC) *cppb.TRCResponse {
return &cppb.TRCResponse{
Trc: trc.Raw,
Trc: trc.Raw, // nolint - name from protobuf
}
}
2 changes: 1 addition & 1 deletion control/trust/grpc/proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ func TestChainsToRep(t *testing.T) {
func TestTRCToRep(t *testing.T) {
trc := cppki.SignedTRC{Raw: []byte("you can trust me, for sure!")}
rep := trustgrpc.TRCToResponse(trc)
assert.Equal(t, trc.Raw, rep.Trc)
assert.Equal(t, trc.Raw, rep.Trc) // nolint - name from published protobuf
}
4 changes: 2 additions & 2 deletions daemon/internal/servers/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
)

type Topology interface {
InterfaceIDs() []uint16
IfIDs() []uint16
UnderlayNextHop(uint16) *net.UDPAddr
ControlServiceAddresses() []*net.UDPAddr
PortRange() (uint16, uint16)
Expand Down Expand Up @@ -277,7 +277,7 @@ func (s *DaemonServer) interfaces(ctx context.Context,
Interfaces: make(map[uint64]*sdpb.Interface),
}
topo := s.Topology
for _, ifID := range topo.InterfaceIDs() {
for _, ifID := range topo.IfIDs() {
nextHop := topo.UnderlayNextHop(ifID)
if nextHop == nil {
continue
Expand Down
14 changes: 9 additions & 5 deletions daemon/mgmtapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,24 @@ func (s *Server) GetCertificateBlob(w http.ResponseWriter, r *http.Request, chai
}

// GetTrcs gets the trcs specified by it's params.
func (s *Server) GetTrcs(w http.ResponseWriter, r *http.Request, params GetTrcsParams) {
cppkiParams := cppkiapi.GetTrcsParams{
func (s *Server) GetTrcs(
w http.ResponseWriter,
r *http.Request,
params GetTrcsParams, // nolint - name from published API
) {
cppkiParams := cppkiapi.GetTrcsParams{ // nolint - name from published API
Isd: params.Isd,
All: params.All,
}
s.CPPKIServer.GetTrcs(w, r, cppkiParams)
s.CPPKIServer.GetTrcs(w, r, cppkiParams) // nolint - name from published API
}

// GetTrc gets the trc specified by it's isd base and serial.
func (s *Server) GetTrc(w http.ResponseWriter, r *http.Request, isd int, base int, serial int) {
s.CPPKIServer.GetTrc(w, r, isd, base, serial)
s.CPPKIServer.GetTrc(w, r, isd, base, serial) // nolint - name from published API
}

// GetTrcBlob gets the trc encoded pem blob.
func (s *Server) GetTrcBlob(w http.ResponseWriter, r *http.Request, isd int, base int, serial int) {
s.CPPKIServer.GetTrcBlob(w, r, isd, base, serial)
s.CPPKIServer.GetTrcBlob(w, r, isd, base, serial) // nolint - name from published API
}
2 changes: 1 addition & 1 deletion pkg/experimental/hiddenpath/beaconwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func interfaceInfos(topo topology.Topology) map[uint16]ifstate.InterfaceInfo {
IA: info.IA,
LinkType: info.LinkType,
InternalAddr: netip.MustParseAddrPort(info.InternalAddr.String()),
RemoteID: uint16(info.RemoteIFID),
RemoteID: uint16(info.RemoteIfID),
MTU: uint16(info.MTU),
}
}
Expand Down
Loading

0 comments on commit c9cfa94

Please sign in to comment.