Skip to content

Commit

Permalink
hackathon: add wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
oncilla committed Nov 4, 2023
1 parent eca2eff commit f0d7985
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
21 changes: 21 additions & 0 deletions control/beaconing/connect/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package connect

import (
"context"

"connectrpc.com/connect"
"github.com/scionproto/scion/control/beaconing/grpc"
"github.com/scionproto/scion/pkg/proto/control_plane"
)

type SegmentCreationServer struct {
grpc.SegmentCreationServer
}

func (s SegmentCreationServer) Beacon(ctx context.Context, req *connect.Request[control_plane.BeaconRequest]) (*connect.Response[control_plane.BeaconResponse], error) {
rep, err := s.SegmentCreationServer.Beacon(ctx, req.Msg)
if err != nil {
return nil, err
}
return connect.NewResponse(rep), nil
}
21 changes: 21 additions & 0 deletions control/segreg/connect/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package connect

import (
"context"

"connectrpc.com/connect"
"github.com/scionproto/scion/control/segreg/grpc"
"github.com/scionproto/scion/pkg/proto/control_plane"
)

type RegistrationServer struct {
grpc.RegistrationServer
}

func (s RegistrationServer) SegmentsRegistration(ctx context.Context, req *connect.Request[control_plane.SegmentsRegistrationRequest]) (*connect.Response[control_plane.SegmentsRegistrationResponse], error) {
rep, err := s.RegistrationServer.SegmentsRegistration(ctx, req.Msg)
if err != nil {
return nil, err
}
return connect.NewResponse(rep), nil
}
21 changes: 21 additions & 0 deletions control/segreq/connect/lookup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package connect

import (
"context"

"connectrpc.com/connect"
"github.com/scionproto/scion/control/segreq/grpc"
"github.com/scionproto/scion/pkg/proto/control_plane"
)

type LookupServer struct {
grpc.LookupServer
}

func (s LookupServer) Segments(ctx context.Context, req *connect.Request[control_plane.SegmentsRequest]) (*connect.Response[control_plane.SegmentsResponse], error) {
rep, err := s.LookupServer.Segments(ctx, req.Msg)
if err != nil {
return nil, err
}
return connect.NewResponse(rep), nil
}
24 changes: 24 additions & 0 deletions private/ca/renewal/connect/renewal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package connect

import (
"context"

"connectrpc.com/connect"
"github.com/scionproto/scion/bufgen/proto/control_plane/v1/control_planeconnect"
"github.com/scionproto/scion/pkg/proto/control_plane"
"github.com/scionproto/scion/private/ca/renewal/grpc"
)

var _ control_planeconnect.ChainRenewalServiceHandler = RenewalServer{}

type RenewalServer struct {
grpc.RenewalServer
}

func (m RenewalServer) ChainRenewal(ctx context.Context, req *connect.Request[control_plane.ChainRenewalRequest]) (*connect.Response[control_plane.ChainRenewalResponse], error) {
rep, err := m.RenewalServer.ChainRenewal(ctx, req.Msg)
if err != nil {
return nil, err
}
return connect.NewResponse(rep), nil
}

0 comments on commit f0d7985

Please sign in to comment.