meshservice

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HandshakeResponse_Result_name = map[int32]string{
		0: "OK",
		1: "ERROR",
	}
	HandshakeResponse_Result_value = map[string]int32{
		"OK":    0,
		"ERROR": 1,
	}
)

Enum value maps for HandshakeResponse_Result.

View Source
var (
	JoinResponse_Result_name = map[int32]string{
		0: "OK",
		1: "ERROR",
	}
	JoinResponse_Result_value = map[string]int32{
		"OK":    0,
		"ERROR": 1,
	}
)

Enum value maps for JoinResponse_Result.

View Source
var (
	LeaveResponse_Result_name = map[int32]string{
		0: "OK",
		1: "ERROR",
	}
	LeaveResponse_Result_value = map[string]int32{
		"OK":    0,
		"ERROR": 1,
	}
)

Enum value maps for LeaveResponse_Result.

View Source
var (
	Peer_AnnouncementType_name = map[int32]string{
		0: "JOIN",
		1: "LEAVE",
	}
	Peer_AnnouncementType_value = map[string]int32{
		"JOIN":  0,
		"LEAVE": 1,
	}
)

Enum value maps for Peer_AnnouncementType.

View Source
var Agent_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "meshservice.Agent",
	HandlerType: (*AgentServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Info",
			Handler:    _Agent_Info_Handler,
		},
		{
			MethodName: "Tag",
			Handler:    _Agent_Tag_Handler,
		},
		{
			MethodName: "Untag",
			Handler:    _Agent_Untag_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Nodes",
			Handler:       _Agent_Nodes_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "WaitForChangeInMesh",
			Handler:       _Agent_WaitForChangeInMesh_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Tags",
			Handler:       _Agent_Tags_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "RTT",
			Handler:       _Agent_RTT_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "agent.proto",
}

Agent_ServiceDesc is the grpc.ServiceDesc for Agent service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_agent_proto protoreflect.FileDescriptor
View Source
var File_meshservice_proto protoreflect.FileDescriptor
View Source
var Mesh_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "meshservice.Mesh",
	HandlerType: (*MeshServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Begin",
			Handler:    _Mesh_Begin_Handler,
		},
		{
			MethodName: "Join",
			Handler:    _Mesh_Join_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Peers",
			Handler:       _Mesh_Peers_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "meshservice.proto",
}

Mesh_ServiceDesc is the grpc.ServiceDesc for Mesh service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterAgentServer

func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer)

func RegisterMeshServer

func RegisterMeshServer(s grpc.ServiceRegistrar, srv MeshServer)

Types

type AgentClient

type AgentClient interface {
	// Info returns a summary about the running mesh
	Info(ctx context.Context, in *AgentEmpty, opts ...grpc.CallOption) (*MeshInfo, error)
	// Nodes streams the current list of nodes known to the mesh
	Nodes(ctx context.Context, in *AgentEmpty, opts ...grpc.CallOption) (Agent_NodesClient, error)
	// This methods blocks until a change in the mesh setup
	// has occured
	WaitForChangeInMesh(ctx context.Context, in *WaitInfo, opts ...grpc.CallOption) (Agent_WaitForChangeInMeshClient, error)
	// Tag sets a tag on a wgmesh node
	Tag(ctx context.Context, in *NodeTag, opts ...grpc.CallOption) (*TagResult, error)
	// Untag remove a tag on a wgmesh node
	Untag(ctx context.Context, in *NodeTag, opts ...grpc.CallOption) (*TagResult, error)
	// Tags streams all tags of the local node
	Tags(ctx context.Context, in *AgentEmpty, opts ...grpc.CallOption) (Agent_TagsClient, error)
	// RTT yields the complete rtt timings for all nodes
	RTT(ctx context.Context, in *AgentEmpty, opts ...grpc.CallOption) (Agent_RTTClient, error)
}

AgentClient is the client API for Agent service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewAgentClient

func NewAgentClient(cc grpc.ClientConnInterface) AgentClient

type AgentEmpty

type AgentEmpty struct {
	// contains filtered or unexported fields
}

func (*AgentEmpty) Descriptor deprecated

func (*AgentEmpty) Descriptor() ([]byte, []int)

Deprecated: Use AgentEmpty.ProtoReflect.Descriptor instead.

func (*AgentEmpty) ProtoMessage

func (*AgentEmpty) ProtoMessage()

func (*AgentEmpty) ProtoReflect

func (x *AgentEmpty) ProtoReflect() protoreflect.Message

func (*AgentEmpty) Reset

func (x *AgentEmpty) Reset()

func (*AgentEmpty) String

func (x *AgentEmpty) String() string

type AgentServer

type AgentServer interface {
	// Info returns a summary about the running mesh
	Info(context.Context, *AgentEmpty) (*MeshInfo, error)
	// Nodes streams the current list of nodes known to the mesh
	Nodes(*AgentEmpty, Agent_NodesServer) error
	// This methods blocks until a change in the mesh setup
	// has occured
	WaitForChangeInMesh(*WaitInfo, Agent_WaitForChangeInMeshServer) error
	// Tag sets a tag on a wgmesh node
	Tag(context.Context, *NodeTag) (*TagResult, error)
	// Untag remove a tag on a wgmesh node
	Untag(context.Context, *NodeTag) (*TagResult, error)
	// Tags streams all tags of the local node
	Tags(*AgentEmpty, Agent_TagsServer) error
	// RTT yields the complete rtt timings for all nodes
	RTT(*AgentEmpty, Agent_RTTServer) error
	// contains filtered or unexported methods
}

AgentServer is the server API for Agent service. All implementations must embed UnimplementedAgentServer for forward compatibility

type Agent_NodesClient

type Agent_NodesClient interface {
	Recv() (*MemberInfo, error)
	grpc.ClientStream
}

type Agent_NodesServer

type Agent_NodesServer interface {
	Send(*MemberInfo) error
	grpc.ServerStream
}

type Agent_RTTClient

type Agent_RTTClient interface {
	Recv() (*RTTInfo, error)
	grpc.ClientStream
}

type Agent_RTTServer

type Agent_RTTServer interface {
	Send(*RTTInfo) error
	grpc.ServerStream
}

type Agent_TagsClient added in v0.1.2

type Agent_TagsClient interface {
	Recv() (*NodeTag, error)
	grpc.ClientStream
}

type Agent_TagsServer added in v0.1.2

type Agent_TagsServer interface {
	Send(*NodeTag) error
	grpc.ServerStream
}

type Agent_WaitForChangeInMeshClient

type Agent_WaitForChangeInMeshClient interface {
	Recv() (*WaitResponse, error)
	grpc.ClientStream
}

type Agent_WaitForChangeInMeshServer

type Agent_WaitForChangeInMeshServer interface {
	Send(*WaitResponse) error
	grpc.ServerStream
}

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

func (*Empty) Descriptor deprecated

func (*Empty) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type HandshakeRequest

type HandshakeRequest struct {

	// name of mesh to join
	MeshName string `protobuf:"bytes,1,opt,name=meshName,proto3" json:"meshName,omitempty"`
	// contains filtered or unexported fields
}

func (*HandshakeRequest) Descriptor deprecated

func (*HandshakeRequest) Descriptor() ([]byte, []int)

Deprecated: Use HandshakeRequest.ProtoReflect.Descriptor instead.

func (*HandshakeRequest) GetMeshName

func (x *HandshakeRequest) GetMeshName() string

func (*HandshakeRequest) ProtoMessage

func (*HandshakeRequest) ProtoMessage()

func (*HandshakeRequest) ProtoReflect

func (x *HandshakeRequest) ProtoReflect() protoreflect.Message

func (*HandshakeRequest) Reset

func (x *HandshakeRequest) Reset()

func (*HandshakeRequest) String

func (x *HandshakeRequest) String() string

type HandshakeResponse

type HandshakeResponse struct {
	Result       HandshakeResponse_Result `protobuf:"varint,1,opt,name=result,proto3,enum=meshservice.HandshakeResponse_Result" json:"result,omitempty"`
	ErrorMessage string                   `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"`
	// token which joining node has to reuse when using Join/Peers methods
	JoinToken string `protobuf:"bytes,3,opt,name=joinToken,proto3" json:"joinToken,omitempty"`
	// additional authentication/authorization requirements which joining nodes have to fulfil
	// Reserved for future use
	AuthReqs map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*HandshakeResponse) Descriptor deprecated

func (*HandshakeResponse) Descriptor() ([]byte, []int)

Deprecated: Use HandshakeResponse.ProtoReflect.Descriptor instead.

func (*HandshakeResponse) GetAuthReqs added in v0.1.2

func (x *HandshakeResponse) GetAuthReqs() map[string]string

func (*HandshakeResponse) GetErrorMessage

func (x *HandshakeResponse) GetErrorMessage() string

func (*HandshakeResponse) GetJoinToken

func (x *HandshakeResponse) GetJoinToken() string

func (*HandshakeResponse) GetResult

func (*HandshakeResponse) ProtoMessage

func (*HandshakeResponse) ProtoMessage()

func (*HandshakeResponse) ProtoReflect

func (x *HandshakeResponse) ProtoReflect() protoreflect.Message

func (*HandshakeResponse) Reset

func (x *HandshakeResponse) Reset()

func (*HandshakeResponse) String

func (x *HandshakeResponse) String() string

type HandshakeResponse_Result

type HandshakeResponse_Result int32
const (
	HandshakeResponse_OK    HandshakeResponse_Result = 0
	HandshakeResponse_ERROR HandshakeResponse_Result = 1
)

func (HandshakeResponse_Result) Descriptor

func (HandshakeResponse_Result) Enum

func (HandshakeResponse_Result) EnumDescriptor deprecated

func (HandshakeResponse_Result) EnumDescriptor() ([]byte, []int)

Deprecated: Use HandshakeResponse_Result.Descriptor instead.

func (HandshakeResponse_Result) Number

func (HandshakeResponse_Result) String

func (x HandshakeResponse_Result) String() string

func (HandshakeResponse_Result) Type

type JoinRequest

type JoinRequest struct {

	// wireguard: public key of joining node
	Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// wireguard: endpoint IP of joining node
	EndpointIP string `protobuf:"bytes,2,opt,name=endpointIP,proto3" json:"endpointIP,omitempty"`
	// wireguard: endpoint UDP port of joining node
	EndpointPort int32 `protobuf:"varint,3,opt,name=endpointPort,proto3" json:"endpointPort,omitempty"`
	// name of mesh to join
	MeshName string `protobuf:"bytes,4,opt,name=meshName,proto3" json:"meshName,omitempty"`
	// optional name of node
	NodeName string `protobuf:"bytes,5,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	// NAT mode
	Nat bool `protobuf:"varint,6,opt,name=nat,proto3" json:"nat,omitempty"`
	// contains filtered or unexported fields
}

func (*JoinRequest) Descriptor deprecated

func (*JoinRequest) Descriptor() ([]byte, []int)

Deprecated: Use JoinRequest.ProtoReflect.Descriptor instead.

func (*JoinRequest) GetEndpointIP

func (x *JoinRequest) GetEndpointIP() string

func (*JoinRequest) GetEndpointPort

func (x *JoinRequest) GetEndpointPort() int32

func (*JoinRequest) GetMeshName

func (x *JoinRequest) GetMeshName() string

func (*JoinRequest) GetNat added in v0.1.2

func (x *JoinRequest) GetNat() bool

func (*JoinRequest) GetNodeName added in v0.1.2

func (x *JoinRequest) GetNodeName() string

func (*JoinRequest) GetPubkey

func (x *JoinRequest) GetPubkey() string

func (*JoinRequest) ProtoMessage

func (*JoinRequest) ProtoMessage()

func (*JoinRequest) ProtoReflect

func (x *JoinRequest) ProtoReflect() protoreflect.Message

func (*JoinRequest) Reset

func (x *JoinRequest) Reset()

func (*JoinRequest) String

func (x *JoinRequest) String() string

type JoinResponse

type JoinResponse struct {
	Result       JoinResponse_Result `protobuf:"varint,1,opt,name=result,proto3,enum=meshservice.JoinResponse_Result" json:"result,omitempty"`
	ErrorMessage string              `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"`
	// this will be the joining's mesh ip
	JoiningNodeMeshIP string `protobuf:"bytes,3,opt,name=joiningNodeMeshIP,proto3" json:"joiningNodeMeshIP,omitempty"`
	// cidr of the mesh
	MeshCidr string `protobuf:"bytes,4,opt,name=meshCidr,proto3" json:"meshCidr,omitempty"`
	// creation time stamp
	CreationTS int64 `protobuf:"varint,5,opt,name=creationTS,proto3" json:"creationTS,omitempty"`
	// encryption key for serf gossip protocol
	SerfEncryptionKey string `protobuf:"bytes,6,opt,name=serfEncryptionKey,proto3" json:"serfEncryptionKey,omitempty"`
	// use serf LAN configuration (true) or WAN configuration (false)
	SerfModeLAN bool `protobuf:"varint,7,opt,name=serfModeLAN,proto3" json:"serfModeLAN,omitempty"`
	// contains filtered or unexported fields
}

func (*JoinResponse) Descriptor deprecated

func (*JoinResponse) Descriptor() ([]byte, []int)

Deprecated: Use JoinResponse.ProtoReflect.Descriptor instead.

func (*JoinResponse) GetCreationTS

func (x *JoinResponse) GetCreationTS() int64

func (*JoinResponse) GetErrorMessage

func (x *JoinResponse) GetErrorMessage() string

func (*JoinResponse) GetJoiningNodeMeshIP added in v0.1.2

func (x *JoinResponse) GetJoiningNodeMeshIP() string

func (*JoinResponse) GetMeshCidr

func (x *JoinResponse) GetMeshCidr() string

func (*JoinResponse) GetResult

func (x *JoinResponse) GetResult() JoinResponse_Result

func (*JoinResponse) GetSerfEncryptionKey added in v0.1.1

func (x *JoinResponse) GetSerfEncryptionKey() string

func (*JoinResponse) GetSerfModeLAN added in v0.1.2

func (x *JoinResponse) GetSerfModeLAN() bool

func (*JoinResponse) ProtoMessage

func (*JoinResponse) ProtoMessage()

func (*JoinResponse) ProtoReflect

func (x *JoinResponse) ProtoReflect() protoreflect.Message

func (*JoinResponse) Reset

func (x *JoinResponse) Reset()

func (*JoinResponse) String

func (x *JoinResponse) String() string

type JoinResponse_Result

type JoinResponse_Result int32
const (
	JoinResponse_OK    JoinResponse_Result = 0
	JoinResponse_ERROR JoinResponse_Result = 1
)

func (JoinResponse_Result) Descriptor

func (JoinResponse_Result) Enum

func (JoinResponse_Result) EnumDescriptor deprecated

func (JoinResponse_Result) EnumDescriptor() ([]byte, []int)

Deprecated: Use JoinResponse_Result.Descriptor instead.

func (JoinResponse_Result) Number

func (JoinResponse_Result) String

func (x JoinResponse_Result) String() string

func (JoinResponse_Result) Type

type LeaveRequest

type LeaveRequest struct {
	Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*LeaveRequest) Descriptor deprecated

func (*LeaveRequest) Descriptor() ([]byte, []int)

Deprecated: Use LeaveRequest.ProtoReflect.Descriptor instead.

func (*LeaveRequest) GetPubkey

func (x *LeaveRequest) GetPubkey() string

func (*LeaveRequest) ProtoMessage

func (*LeaveRequest) ProtoMessage()

func (*LeaveRequest) ProtoReflect

func (x *LeaveRequest) ProtoReflect() protoreflect.Message

func (*LeaveRequest) Reset

func (x *LeaveRequest) Reset()

func (*LeaveRequest) String

func (x *LeaveRequest) String() string

type LeaveResponse

type LeaveResponse struct {
	Result       LeaveResponse_Result `protobuf:"varint,1,opt,name=result,proto3,enum=meshservice.LeaveResponse_Result" json:"result,omitempty"`
	ErrorMessage string               `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"`
	// contains filtered or unexported fields
}

func (*LeaveResponse) Descriptor deprecated

func (*LeaveResponse) Descriptor() ([]byte, []int)

Deprecated: Use LeaveResponse.ProtoReflect.Descriptor instead.

func (*LeaveResponse) GetErrorMessage

func (x *LeaveResponse) GetErrorMessage() string

func (*LeaveResponse) GetResult

func (x *LeaveResponse) GetResult() LeaveResponse_Result

func (*LeaveResponse) ProtoMessage

func (*LeaveResponse) ProtoMessage()

func (*LeaveResponse) ProtoReflect

func (x *LeaveResponse) ProtoReflect() protoreflect.Message

func (*LeaveResponse) Reset

func (x *LeaveResponse) Reset()

func (*LeaveResponse) String

func (x *LeaveResponse) String() string

type LeaveResponse_Result

type LeaveResponse_Result int32
const (
	LeaveResponse_OK    LeaveResponse_Result = 0
	LeaveResponse_ERROR LeaveResponse_Result = 1
)

func (LeaveResponse_Result) Descriptor

func (LeaveResponse_Result) Enum

func (LeaveResponse_Result) EnumDescriptor deprecated

func (LeaveResponse_Result) EnumDescriptor() ([]byte, []int)

Deprecated: Use LeaveResponse_Result.Descriptor instead.

func (LeaveResponse_Result) Number

func (LeaveResponse_Result) String

func (x LeaveResponse_Result) String() string

func (LeaveResponse_Result) Type

type MemberInfo

type MemberInfo struct {
	NodeName    string           `protobuf:"bytes,1,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	Addr        string           `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	Status      string           `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	RttMsec     int32            `protobuf:"varint,4,opt,name=rttMsec,proto3" json:"rttMsec,omitempty"`
	Tags        []*MemberInfoTag `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"`
	IsLocalNode bool             `protobuf:"varint,6,opt,name=isLocalNode,proto3" json:"isLocalNode,omitempty"`
	// contains filtered or unexported fields
}

func (*MemberInfo) Descriptor deprecated

func (*MemberInfo) Descriptor() ([]byte, []int)

Deprecated: Use MemberInfo.ProtoReflect.Descriptor instead.

func (*MemberInfo) GetAddr

func (x *MemberInfo) GetAddr() string

func (*MemberInfo) GetIsLocalNode added in v0.1.2

func (x *MemberInfo) GetIsLocalNode() bool

func (*MemberInfo) GetNodeName

func (x *MemberInfo) GetNodeName() string

func (*MemberInfo) GetRttMsec

func (x *MemberInfo) GetRttMsec() int32

func (*MemberInfo) GetStatus

func (x *MemberInfo) GetStatus() string

func (*MemberInfo) GetTags

func (x *MemberInfo) GetTags() []*MemberInfoTag

func (*MemberInfo) ProtoMessage

func (*MemberInfo) ProtoMessage()

func (*MemberInfo) ProtoReflect

func (x *MemberInfo) ProtoReflect() protoreflect.Message

func (*MemberInfo) Reset

func (x *MemberInfo) Reset()

func (*MemberInfo) String

func (x *MemberInfo) String() string

type MemberInfoTag

type MemberInfoTag struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*MemberInfoTag) Descriptor deprecated

func (*MemberInfoTag) Descriptor() ([]byte, []int)

Deprecated: Use MemberInfoTag.ProtoReflect.Descriptor instead.

func (*MemberInfoTag) GetKey

func (x *MemberInfoTag) GetKey() string

func (*MemberInfoTag) GetValue

func (x *MemberInfoTag) GetValue() string

func (*MemberInfoTag) ProtoMessage

func (*MemberInfoTag) ProtoMessage()

func (*MemberInfoTag) ProtoReflect

func (x *MemberInfoTag) ProtoReflect() protoreflect.Message

func (*MemberInfoTag) Reset

func (x *MemberInfoTag) Reset()

func (*MemberInfoTag) String

func (x *MemberInfoTag) String() string

type MeshAgentServer

type MeshAgentServer struct {
	UnimplementedAgentServer
	// contains filtered or unexported fields
}

MeshAgentServer implements the gRPC part of agent.proto

func NewMeshAgentServerSocket

func NewMeshAgentServerSocket(ms *MeshService, grpcBindSocket string, grpcBindSocketID string) *MeshAgentServer

NewMeshAgentServerSocket creates a new agent service for a local bind socket

func (*MeshAgentServer) Info

func (as *MeshAgentServer) Info(ctx context.Context, ae *AgentEmpty) (*MeshInfo, error)

Info returns details about the mesh

func (*MeshAgentServer) Nodes

func (as *MeshAgentServer) Nodes(cte *AgentEmpty, agentNodesServer Agent_NodesServer) error

Nodes ...

func (*MeshAgentServer) RTT

func (as *MeshAgentServer) RTT(cte *AgentEmpty, rttServer Agent_RTTServer) error

RTT ...

func (*MeshAgentServer) StartAgentGrpcService

func (as *MeshAgentServer) StartAgentGrpcService() error

StartAgentGrpcService ..

func (*MeshAgentServer) StopAgentGrpcService

func (as *MeshAgentServer) StopAgentGrpcService()

StopAgentGrpcService ...

func (*MeshAgentServer) Tag

func (as *MeshAgentServer) Tag(ctx context.Context, tr *NodeTag) (*TagResult, error)

Tag ...

func (*MeshAgentServer) Tags added in v0.1.2

func (as *MeshAgentServer) Tags(cte *AgentEmpty, server Agent_TagsServer) error

Tags streams all current tags of the local node

func (*MeshAgentServer) Untag

func (as *MeshAgentServer) Untag(ctx context.Context, tr *NodeTag) (*TagResult, error)

Untag ...

func (*MeshAgentServer) WaitForChangeInMesh

func (as *MeshAgentServer) WaitForChangeInMesh(wi *WaitInfo, server Agent_WaitForChangeInMeshServer) error

WaitForChangeInMesh ...

type MeshClient

type MeshClient interface {
	// Joining node starts to shake hands and receives a token and
	// additional authorization requirements
	Begin(ctx context.Context, in *HandshakeRequest, opts ...grpc.CallOption) (*HandshakeResponse, error)
	// BeginJoin begins the join process by sending a JoinRequest
	// and receiving a JoinResponse with setup details
	Join(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*JoinResponse, error)
	// Peers returns a stream of all peers currently connected to the mesh
	Peers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (Mesh_PeersClient, error)
}

MeshClient is the client API for Mesh service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewMeshClient

func NewMeshClient(cc grpc.ClientConnInterface) MeshClient

type MeshInfo

type MeshInfo struct {
	Name          string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	NodeCount     int32  `protobuf:"varint,2,opt,name=nodeCount,proto3" json:"nodeCount,omitempty"`
	NodeName      string `protobuf:"bytes,3,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	MeshCeationTS int64  `protobuf:"varint,4,opt,name=meshCeationTS,proto3" json:"meshCeationTS,omitempty"`
	NodeJoinTS    int64  `protobuf:"varint,5,opt,name=nodeJoinTS,proto3" json:"nodeJoinTS,omitempty"`
	// contains filtered or unexported fields
}

func (*MeshInfo) Descriptor deprecated

func (*MeshInfo) Descriptor() ([]byte, []int)

Deprecated: Use MeshInfo.ProtoReflect.Descriptor instead.

func (*MeshInfo) GetMeshCeationTS

func (x *MeshInfo) GetMeshCeationTS() int64

func (*MeshInfo) GetName

func (x *MeshInfo) GetName() string

func (*MeshInfo) GetNodeCount

func (x *MeshInfo) GetNodeCount() int32

func (*MeshInfo) GetNodeJoinTS

func (x *MeshInfo) GetNodeJoinTS() int64

func (*MeshInfo) GetNodeName

func (x *MeshInfo) GetNodeName() string

func (*MeshInfo) ProtoMessage

func (*MeshInfo) ProtoMessage()

func (*MeshInfo) ProtoReflect

func (x *MeshInfo) ProtoReflect() protoreflect.Message

func (*MeshInfo) Reset

func (x *MeshInfo) Reset()

func (*MeshInfo) String

func (x *MeshInfo) String() string

type MeshServer

type MeshServer interface {
	// Joining node starts to shake hands and receives a token and
	// additional authorization requirements
	Begin(context.Context, *HandshakeRequest) (*HandshakeResponse, error)
	// BeginJoin begins the join process by sending a JoinRequest
	// and receiving a JoinResponse with setup details
	Join(context.Context, *JoinRequest) (*JoinResponse, error)
	// Peers returns a stream of all peers currently connected to the mesh
	Peers(*Empty, Mesh_PeersServer) error
	// contains filtered or unexported methods
}

MeshServer is the server API for Mesh service. All implementations must embed UnimplementedMeshServer for forward compatibility

type MeshService

type MeshService struct {
	// Name of the mesh network.
	MeshName string

	// Name of this node
	NodeName string

	// eg. 10.232.0.0/16. All nodes in the mesh will have an
	// IP address within this range
	CIDRRange net.IPNet

	// If set, this bootstrap will assign IP addresses from
	// this range only.
	CIDRRangeIPAM *net.IPNet

	// Local mesh IP of this node
	MeshIP net.IPNet

	// Listen port for Wireguard
	WireguardListenPort int

	// Listen IP for Wireguard
	WireguardListenIP net.IP

	// Own public key
	WireguardPubKey string

	// The interface we're controlling
	WireguardInterface wgwrapper.WireguardInterface

	// Bind Address for gRPC Mesh service
	GrpcBindAddr string

	// Bind port for gRPC Mesh service
	GrpcBindPort int

	// (optional) TLS config struct for gRPC Mesh service
	TLSConfig *TLSConfig

	// gRPC
	UnimplementedMeshServer

	// Local agent gRPC server
	MeshAgentServer *MeshAgentServer
	// contains filtered or unexported fields
}

MeshService collects all information about running a mesh node for both bootstrap and join modes.

func NewMeshService

func NewMeshService(meshName string) MeshService

NewMeshService creates a new MeshService for a node

func (*MeshService) ApplyPeerUpdatesFromStream

func (ms *MeshService) ApplyPeerUpdatesFromStream(wg wgwrapper.WireguardWrapper, stream Mesh_PeersClient) []string

ApplyPeerUpdatesFromStream reads peer data from an incoming stream and apply these to the interface. Returns a list of MeshIPs from all peers, with the first entry being the bootstrap node where we joined.

func (*MeshService) AssignJoiningNodeIP added in v0.1.2

func (ms *MeshService) AssignJoiningNodeIP(ip string) error

AssignJoiningNodeIP sets the ip address of the wireguard interface

func (*MeshService) Begin added in v0.1.2

Begin starts the join process with a handshake

func (*MeshService) CreateWireguardInterface

func (ms *MeshService) CreateWireguardInterface(wgListenPort int) (string, error)

CreateWireguardInterface creates a new wireguard interface based on the name of the mesh, and a listen port. The interfacae does not yet carry an internal ip and is not up'ed. Returns the pub key

func (*MeshService) CreateWireguardInterfaceForMesh

func (ms *MeshService) CreateWireguardInterfaceForMesh(bootstrapIP string, wgListenPort int) (string, error)

CreateWireguardInterfaceForMesh creates a new wireguard interface based on the name of the mesh, a bootstrap IP and a listen port. The interfacae is also up'ed.

func (*MeshService) DeregisterEventNotifier

func (ms *MeshService) DeregisterEventNotifier(key string)

DeregisterEventNotifier registers an channel

func (*MeshService) GetEncryptionKey added in v0.1.1

func (ms *MeshService) GetEncryptionKey() string

GetEncryptionKey returns serf encryption key from a base64 string

func (*MeshService) GetTimestamps

func (ms *MeshService) GetTimestamps() (time.Time, time.Time)

GetTimestamps returns the creation and join timestamp

func (*MeshService) Join

func (ms *MeshService) Join(ctx context.Context, req *JoinRequest) (*JoinResponse, error)

Join allows other nodes to join by sending a JoinRequest

func (*MeshService) JoinSerfCluster

func (ms *MeshService) JoinSerfCluster(clusterNodes []string)

JoinSerfCluster calls serf.Join, given a number of cluster nodes received from the bootstrap node

func (*MeshService) LeaveSerfCluster

func (ms *MeshService) LeaveSerfCluster()

LeaveSerfCluster leaves the cluster

func (*MeshService) NewSerfCluster

func (ms *MeshService) NewSerfCluster(lanMode bool)

NewSerfCluster sets up a cluster with a given nodeName, a bind address. it also registers a user event listener which acts upon Join and Leave user messages

func (*MeshService) Peers

func (ms *MeshService) Peers(e *Empty, stream Mesh_PeersServer) error

Peers serves a list of all current peers, starting with this node. All data is derived from serf's memberlist

func (*MeshService) RegisterEventNotifier

func (ms *MeshService) RegisterEventNotifier(key string, sec SerfEventChan)

RegisterEventNotifier registers an channel

func (*MeshService) RemoveWireguardInterfaceForMesh

func (ms *MeshService) RemoveWireguardInterfaceForMesh() error

RemoveWireguardInterfaceForMesh removes the wireguard interface for this mesh Removing the interface will also remove the route(s) associated with it.

func (*MeshService) Serf added in v0.1.2

func (ms *MeshService) Serf() *serf.Serf

Serf returns the serf instance

func (*MeshService) SetEncryptionKey added in v0.1.1

func (ms *MeshService) SetEncryptionKey(encKeyB64 string) error

SetEncryptionKey sets serf encryption key from a base64 string

func (*MeshService) SetMemberlistExportFile

func (ms *MeshService) SetMemberlistExportFile(f string)

SetMemberlistExportFile sets the file name for an export of the current memberlist. If empty no file is written

func (*MeshService) SetNodeName

func (ms *MeshService) SetNodeName(name string)

SetNodeName applies a name to this node

func (*MeshService) SetRoute

func (ms *MeshService) SetRoute() error

SetRoute adds a route for the cidr range to the wireguard interface

func (*MeshService) SetTimestamps

func (ms *MeshService) SetTimestamps(creationTS, joinTS int64)

SetTimestamps sets the creation and join timestamp after grpc join call

func (*MeshService) StartGrpcService

func (ms *MeshService) StartGrpcService() error

StartGrpcService ..

func (*MeshService) StartSerfCluster

func (ms *MeshService) StartSerfCluster(isBootstrap bool, pubkey string, endpointIP string, endpointPort int, meshIP string) error

StartSerfCluster is used by bootstrap to set up the initial serf cluster node A set of node tags is derived from all parameters so that other nodes have all data to connect.

func (*MeshService) StartStatsUpdater

func (ms *MeshService) StartStatsUpdater()

StartStatsUpdater starts the statistics update ticker

func (*MeshService) StatsUpdate

func (ms *MeshService) StatsUpdate()

StatsUpdate produces a mesh statistic update on log

func (*MeshService) StopGrpcService

func (ms *MeshService) StopGrpcService()

StopGrpcService stops the grpc server

type Mesh_PeersClient

type Mesh_PeersClient interface {
	Recv() (*Peer, error)
	grpc.ClientStream
}

type Mesh_PeersServer

type Mesh_PeersServer interface {
	Send(*Peer) error
	grpc.ServerStream
}

type NodeTag added in v0.1.2

type NodeTag struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeTag) Descriptor deprecated added in v0.1.2

func (*NodeTag) Descriptor() ([]byte, []int)

Deprecated: Use NodeTag.ProtoReflect.Descriptor instead.

func (*NodeTag) GetKey added in v0.1.2

func (x *NodeTag) GetKey() string

func (*NodeTag) GetValue added in v0.1.2

func (x *NodeTag) GetValue() string

func (*NodeTag) ProtoMessage added in v0.1.2

func (*NodeTag) ProtoMessage()

func (*NodeTag) ProtoReflect added in v0.1.2

func (x *NodeTag) ProtoReflect() protoreflect.Message

func (*NodeTag) Reset added in v0.1.2

func (x *NodeTag) Reset()

func (*NodeTag) String added in v0.1.2

func (x *NodeTag) String() string

type Peer

type Peer struct {
	Type         Peer_AnnouncementType `protobuf:"varint,1,opt,name=type,proto3,enum=meshservice.Peer_AnnouncementType" json:"type,omitempty"`
	Pubkey       string                `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`              // public key
	EndpointIP   string                `protobuf:"bytes,3,opt,name=endpointIP,proto3" json:"endpointIP,omitempty"`      // endpoint
	EndpointPort int32                 `protobuf:"varint,4,opt,name=endpointPort,proto3" json:"endpointPort,omitempty"` // endpoint
	MeshIP       string                `protobuf:"bytes,5,opt,name=meshIP,proto3" json:"meshIP,omitempty"`              // internal mesh ip
	// contains filtered or unexported fields
}

Peer contains connection data for an individual Wireguard Peer

func (*Peer) Descriptor deprecated

func (*Peer) Descriptor() ([]byte, []int)

Deprecated: Use Peer.ProtoReflect.Descriptor instead.

func (*Peer) GetEndpointIP

func (x *Peer) GetEndpointIP() string

func (*Peer) GetEndpointPort

func (x *Peer) GetEndpointPort() int32

func (*Peer) GetMeshIP

func (x *Peer) GetMeshIP() string

func (*Peer) GetPubkey

func (x *Peer) GetPubkey() string

func (*Peer) GetType

func (x *Peer) GetType() Peer_AnnouncementType

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) ProtoReflect

func (x *Peer) ProtoReflect() protoreflect.Message

func (*Peer) Reset

func (x *Peer) Reset()

func (*Peer) String

func (x *Peer) String() string

type Peer_AnnouncementType

type Peer_AnnouncementType int32
const (
	Peer_JOIN  Peer_AnnouncementType = 0
	Peer_LEAVE Peer_AnnouncementType = 1
)

func (Peer_AnnouncementType) Descriptor

func (Peer_AnnouncementType) Enum

func (Peer_AnnouncementType) EnumDescriptor deprecated

func (Peer_AnnouncementType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Peer_AnnouncementType.Descriptor instead.

func (Peer_AnnouncementType) Number

func (Peer_AnnouncementType) String

func (x Peer_AnnouncementType) String() string

func (Peer_AnnouncementType) Type

type RTTInfo

type RTTInfo struct {
	NodeName string         `protobuf:"bytes,1,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	Rtts     []*RTTNodeInfo `protobuf:"bytes,2,rep,name=rtts,proto3" json:"rtts,omitempty"`
	// contains filtered or unexported fields
}

func (*RTTInfo) Descriptor deprecated

func (*RTTInfo) Descriptor() ([]byte, []int)

Deprecated: Use RTTInfo.ProtoReflect.Descriptor instead.

func (*RTTInfo) GetNodeName

func (x *RTTInfo) GetNodeName() string

func (*RTTInfo) GetRtts

func (x *RTTInfo) GetRtts() []*RTTNodeInfo

func (*RTTInfo) ProtoMessage

func (*RTTInfo) ProtoMessage()

func (*RTTInfo) ProtoReflect

func (x *RTTInfo) ProtoReflect() protoreflect.Message

func (*RTTInfo) Reset

func (x *RTTInfo) Reset()

func (*RTTInfo) String

func (x *RTTInfo) String() string

type RTTNodeInfo

type RTTNodeInfo struct {
	NodeName string `protobuf:"bytes,1,opt,name=nodeName,proto3" json:"nodeName,omitempty"`
	RttMsec  int32  `protobuf:"varint,2,opt,name=rttMsec,proto3" json:"rttMsec,omitempty"`
	// contains filtered or unexported fields
}

func (*RTTNodeInfo) Descriptor deprecated

func (*RTTNodeInfo) Descriptor() ([]byte, []int)

Deprecated: Use RTTNodeInfo.ProtoReflect.Descriptor instead.

func (*RTTNodeInfo) GetNodeName

func (x *RTTNodeInfo) GetNodeName() string

func (*RTTNodeInfo) GetRttMsec

func (x *RTTNodeInfo) GetRttMsec() int32

func (*RTTNodeInfo) ProtoMessage

func (*RTTNodeInfo) ProtoMessage()

func (*RTTNodeInfo) ProtoReflect

func (x *RTTNodeInfo) ProtoReflect() protoreflect.Message

func (*RTTNodeInfo) Reset

func (x *RTTNodeInfo) Reset()

func (*RTTNodeInfo) String

func (x *RTTNodeInfo) String() string

type RTTRequest

type RTTRequest struct {
	RequestedBy string `protobuf:"bytes,1,opt,name=requestedBy,proto3" json:"requestedBy,omitempty"` // node name
	// contains filtered or unexported fields
}

func (*RTTRequest) Descriptor deprecated

func (*RTTRequest) Descriptor() ([]byte, []int)

Deprecated: Use RTTRequest.ProtoReflect.Descriptor instead.

func (*RTTRequest) GetRequestedBy

func (x *RTTRequest) GetRequestedBy() string

func (*RTTRequest) ProtoMessage

func (*RTTRequest) ProtoMessage()

func (*RTTRequest) ProtoReflect

func (x *RTTRequest) ProtoReflect() protoreflect.Message

func (*RTTRequest) Reset

func (x *RTTRequest) Reset()

func (*RTTRequest) String

func (x *RTTRequest) String() string

type RTTResponse

type RTTResponse struct {
	Node string             `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // node name
	Rtts []*RTTResponseInfo `protobuf:"bytes,2,rep,name=rtts,proto3" json:"rtts,omitempty"`
	// contains filtered or unexported fields
}

func (*RTTResponse) Descriptor deprecated

func (*RTTResponse) Descriptor() ([]byte, []int)

Deprecated: Use RTTResponse.ProtoReflect.Descriptor instead.

func (*RTTResponse) GetNode

func (x *RTTResponse) GetNode() string

func (*RTTResponse) GetRtts

func (x *RTTResponse) GetRtts() []*RTTResponseInfo

func (*RTTResponse) ProtoMessage

func (*RTTResponse) ProtoMessage()

func (*RTTResponse) ProtoReflect

func (x *RTTResponse) ProtoReflect() protoreflect.Message

func (*RTTResponse) Reset

func (x *RTTResponse) Reset()

func (*RTTResponse) String

func (x *RTTResponse) String() string

type RTTResponseInfo

type RTTResponseInfo struct {
	Node    string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` // node name
	RttMsec int32  `protobuf:"varint,2,opt,name=rttMsec,proto3" json:"rttMsec,omitempty"`
	// contains filtered or unexported fields
}

func (*RTTResponseInfo) Descriptor deprecated

func (*RTTResponseInfo) Descriptor() ([]byte, []int)

Deprecated: Use RTTResponseInfo.ProtoReflect.Descriptor instead.

func (*RTTResponseInfo) GetNode

func (x *RTTResponseInfo) GetNode() string

func (*RTTResponseInfo) GetRttMsec

func (x *RTTResponseInfo) GetRttMsec() int32

func (*RTTResponseInfo) ProtoMessage

func (*RTTResponseInfo) ProtoMessage()

func (*RTTResponseInfo) ProtoReflect

func (x *RTTResponseInfo) ProtoReflect() protoreflect.Message

func (*RTTResponseInfo) Reset

func (x *RTTResponseInfo) Reset()

func (*RTTResponseInfo) String

func (x *RTTResponseInfo) String() string

type STUNService added in v0.1.1

type STUNService struct {
	// contains filtered or unexported fields
}

STUNService ...

func NewSTUNService added in v0.1.1

func NewSTUNService() STUNService

NewSTUNService creates a new STUNService struct with default settings working for IPv4

func (*STUNService) GetExternalIP added in v0.1.1

func (st *STUNService) GetExternalIP() ([]net.IP, error)

GetExternalIP retrieves my own external ip by querying it from the STUN server

type SerfEventChan

type SerfEventChan *chan serf.Event

SerfEventChan is a pointer to a channel of serf events, so that events can be forwarded to other listeners

type TLSConfig added in v0.1.1

type TLSConfig struct {
	Cert     tls.Certificate
	CertPool *x509.CertPool
}

TLSConfig ...

func NewTLSConfigFromFiles added in v0.1.1

func NewTLSConfigFromFiles(caCertFile, caPath, certFile, keyFile string) (*TLSConfig, error)

NewTLSConfigFromFiles creates a new TLS config from given files/paths

type TagResult

type TagResult struct {
	Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
	// contains filtered or unexported fields
}

func (*TagResult) Descriptor deprecated

func (*TagResult) Descriptor() ([]byte, []int)

Deprecated: Use TagResult.ProtoReflect.Descriptor instead.

func (*TagResult) GetOk

func (x *TagResult) GetOk() bool

func (*TagResult) ProtoMessage

func (*TagResult) ProtoMessage()

func (*TagResult) ProtoReflect

func (x *TagResult) ProtoReflect() protoreflect.Message

func (*TagResult) Reset

func (x *TagResult) Reset()

func (*TagResult) String

func (x *TagResult) String() string

type UIServer added in v0.1.2

type UIServer struct {
	// contains filtered or unexported fields
}

UIServer ...

func NewUIServer added in v0.1.2

func NewUIServer(agentGrpcSocket string, httpBindAddr string, httpBindPort int) *UIServer

NewUIServer ...

func (*UIServer) Serve added in v0.1.2

func (u *UIServer) Serve()

Serve starts the HTTP server and the agent query

type UnimplementedAgentServer

type UnimplementedAgentServer struct {
}

UnimplementedAgentServer must be embedded to have forward compatible implementations.

func (UnimplementedAgentServer) Info

func (UnimplementedAgentServer) Nodes

func (UnimplementedAgentServer) RTT

func (UnimplementedAgentServer) Tag

func (UnimplementedAgentServer) Tags added in v0.1.2

func (UnimplementedAgentServer) Untag

func (UnimplementedAgentServer) WaitForChangeInMesh

type UnimplementedMeshServer

type UnimplementedMeshServer struct {
}

UnimplementedMeshServer must be embedded to have forward compatible implementations.

func (UnimplementedMeshServer) Begin added in v0.1.2

func (UnimplementedMeshServer) Join

func (UnimplementedMeshServer) Peers

type UnsafeAgentServer

type UnsafeAgentServer interface {
	// contains filtered or unexported methods
}

UnsafeAgentServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AgentServer will result in compilation errors.

type UnsafeMeshServer

type UnsafeMeshServer interface {
	// contains filtered or unexported methods
}

UnsafeMeshServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MeshServer will result in compilation errors.

type WaitInfo

type WaitInfo struct {
	TimeoutSecs int32 `protobuf:"varint,1,opt,name=timeoutSecs,proto3" json:"timeoutSecs,omitempty"`
	// contains filtered or unexported fields
}

func (*WaitInfo) Descriptor deprecated

func (*WaitInfo) Descriptor() ([]byte, []int)

Deprecated: Use WaitInfo.ProtoReflect.Descriptor instead.

func (*WaitInfo) GetTimeoutSecs

func (x *WaitInfo) GetTimeoutSecs() int32

func (*WaitInfo) ProtoMessage

func (*WaitInfo) ProtoMessage()

func (*WaitInfo) ProtoReflect

func (x *WaitInfo) ProtoReflect() protoreflect.Message

func (*WaitInfo) Reset

func (x *WaitInfo) Reset()

func (*WaitInfo) String

func (x *WaitInfo) String() string

type WaitResponse

type WaitResponse struct {

	// true if we ran into a timeout
	WasTimeout bool `protobuf:"varint,1,opt,name=wasTimeout,proto3" json:"wasTimeout,omitempty"`
	// true if changes occured within the
	// mesh setup (nodes joined, left, tags changed, other..)
	ChangesOccured bool `protobuf:"varint,2,opt,name=changesOccured,proto3" json:"changesOccured,omitempty"`
	// contains filtered or unexported fields
}

func (*WaitResponse) Descriptor deprecated

func (*WaitResponse) Descriptor() ([]byte, []int)

Deprecated: Use WaitResponse.ProtoReflect.Descriptor instead.

func (*WaitResponse) GetChangesOccured

func (x *WaitResponse) GetChangesOccured() bool

func (*WaitResponse) GetWasTimeout

func (x *WaitResponse) GetWasTimeout() bool

func (*WaitResponse) ProtoMessage

func (*WaitResponse) ProtoMessage()

func (*WaitResponse) ProtoReflect

func (x *WaitResponse) ProtoReflect() protoreflect.Message

func (*WaitResponse) Reset

func (x *WaitResponse) Reset()

func (*WaitResponse) String

func (x *WaitResponse) String() string

Jump to

Keyboard shortcuts

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