rpc

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "doublezero_qaagent_build_info",
		Help: "Build information of the QA agent",
	},
		[]string{"version", "commit", "date"},
	)
)

Functions

This section is empty.

Types

type Joiner

type Joiner interface {
	JoinGroup(ctx context.Context, group net.IP, port string, ifName string) error
	Stop()
	GetStatistics(net.IP) uint64
}

type Option

type Option func(*QAAgent)

type QAAgent

type QAAgent struct {
	pb.UnimplementedQAAgentServiceServer
	// contains filtered or unexported fields
}

func NewQAAgent

func NewQAAgent(logger *slog.Logger, addr string, j Joiner) (*QAAgent, error)

NewQAAgent creates a new QAAgent instance. It accepts an address (i.e. localhost:443) to listen on and a Joiner interface for managing multicast group joins.

func (*QAAgent) ConnectMulticast

func (q *QAAgent) ConnectMulticast(ctx context.Context, req *pb.ConnectMulticastRequest) (*pb.Result, error)

ConnectMulticast implements the ConnectMulticast RPC, which connects to a multicast group as either a publisher or subscriber.

func (*QAAgent) ConnectUnicast

func (q *QAAgent) ConnectUnicast(ctx context.Context, req *pb.ConnectUnicastRequest) (*pb.Result, error)

ConnectUnicast implements the ConnectUnicast RPC. This establishes a unicast tunnel to DoubleZero using IBRL mode. This call will block until the tunnel is up according to the DoubleZero status output or return an error if the tunnel is not up within 20 seconds.

func (*QAAgent) CreateMulticastGroup

func (q *QAAgent) CreateMulticastGroup(ctx context.Context, req *pb.CreateMulticastGroupRequest) (*pb.Result, error)

CreateMulticastGroup implements the CreateMulticastGroup RPC, which creates a multicast group with the specified code and maximum bandwidth.

func (*QAAgent) DeleteMulticastGroup

func (q *QAAgent) DeleteMulticastGroup(ctx context.Context, req *pb.DeleteMulticastGroupRequest) (*pb.Result, error)

DeleteMulticastGroup implements the DeleteMulticastGroup RPC, which deletes a multicast group by its public key.

func (*QAAgent) Disconnect

func (q *QAAgent) Disconnect(ctx context.Context, req *emptypb.Empty) (*pb.Result, error)

Disconnect implements the Disconnect RPC, which removes the current tunnel from DoubleZero.

func (*QAAgent) GetStatus

func (q *QAAgent) GetStatus(ctx context.Context, req *emptypb.Empty) (*pb.StatusResponse, error)

GetStatus implements the GetStatus RPC, which retrieves the current status of the configured DoubleZero tunnel. This is equivalent to the `doublezero status` command.

func (*QAAgent) MulticastAllowListAdd

func (q *QAAgent) MulticastAllowListAdd(ctx context.Context, req *pb.MulticastAllowListAddRequest) (*pb.Result, error)

MulticastAllowListAdd implements the MulticastAllowListAdd RPC, which adds a publisher or subscriber to the multicast allowlist for a specific group.

func (*QAAgent) MulticastJoin

func (q *QAAgent) MulticastJoin(ctx context.Context, req *pb.MulticastJoinRequest) (*pb.MulticastJoinResult, error)

MulticastJoin implements the MulticastJoin RPC, joins the requested multicast group and counts received packets per joined group. Use the GetStatistics RPC to retrieve the stats.

func (*QAAgent) MulticastLeave

func (q *QAAgent) MulticastLeave(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error)

MulticastLeave implements the MulticastLeave RPC and stops listening to all multicast groups.

func (*QAAgent) MulticastReport

func (q *QAAgent) MulticastReport(ctx context.Context, req *pb.MulticastReportRequest) (*pb.MulticastReportResult, error)

MulticastReport implements the MulticastReport RPC, which retrieves statistics for multicast groups that the agent is currently listening to. It returns the number of packets received for each group.

func (*QAAgent) MulticastSend

func (q *QAAgent) MulticastSend(ctx context.Context, req *pb.MulticastSendRequest) (*emptypb.Empty, error)

MulticastSend implements the MulticastSend RPC, which sends multicast packets to a specified group for a given duration.

func (*QAAgent) Ping

func (q *QAAgent) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResult, error)

Ping implements the Ping RPC, executes a set of ICMP pings, and reports the results to the caller. This requires CAP_NET_RAW capability to run successfully due to the use of raw sockets.

func (*QAAgent) Start

func (q *QAAgent) Start(ctx context.Context) error

Start starts the QAAgent and blocks until the context is done or an error occurs.

type StatusResponse

type StatusResponse struct {
	TunnelName       string `json:"tunnel_name"`
	DoubleZeroIP     net.IP `json:"doublezero_ip"`
	UserType         string `json:"user_type"`
	DoubleZeroStatus struct {
		State string `json:"session_status"`
	} `json:"doublezero_status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL