vpn

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuthType_name = map[int32]string{
		0: "AT_NONE",
		1: "AT_TEST",
		2: "AT_GOOGLE_OPEN_ID",
		3: "AT_AWS_IAM",
	}
	AuthType_value = map[string]int32{
		"AT_NONE":           0,
		"AT_TEST":           1,
		"AT_GOOGLE_OPEN_ID": 2,
		"AT_AWS_IAM":        3,
	}
)

Enum value maps for AuthType.

View Source
var (
	ErrorCode_name = map[int32]string{
		0: "EC_UNKNOWN",
		1: "EC_SUCCESS",
		2: "EC_INVALID_AUTHORIZATION",
		3: "EC_EXPIRED_JWT",
	}
	ErrorCode_value = map[string]int32{
		"EC_UNKNOWN":               0,
		"EC_SUCCESS":               1,
		"EC_INVALID_AUTHORIZATION": 2,
		"EC_EXPIRED_JWT":           3,
	}
)

Enum value maps for ErrorCode.

View Source
var (
	IPPacketType_name = map[int32]string{
		0: "IPPT_UNKNOWN",
		1: "IPPT_RAW",
		2: "IPPT_VPN_ASSIGN",
	}
	IPPacketType_value = map[string]int32{
		"IPPT_UNKNOWN":    0,
		"IPPT_RAW":        1,
		"IPPT_VPN_ASSIGN": 2,
	}
)

Enum value maps for IPPacketType.

View Source
var File_vpn_struct_proto protoreflect.FileDescriptor

Functions

func RegisterVPNServer

func RegisterVPNServer(s *grpc.Server, srv VPNServer)

Types

type AuthRequest

type AuthRequest struct {
	AuthType     AuthType                  `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=vpn.AuthType" json:"auth_type,omitempty"` // auth type
	GoogleOpenId *AuthRequest_GoogleOpenID `protobuf:"bytes,2,opt,name=google_open_id,json=googleOpenId,proto3" json:"google_open_id,omitempty"`      // support google openid connect
	AwsIam       *AuthRequest_AwsIam       `protobuf:"bytes,3,opt,name=aws_iam,json=awsIam,proto3" json:"aws_iam,omitempty"`                          // support aws iam
	// contains filtered or unexported fields
}

func (*AuthRequest) Descriptor deprecated

This method has been deprecated.
func (*AuthRequest) Descriptor() ([]byte, []int)

Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.

func (*AuthRequest) GetAuthType

func (x *AuthRequest) GetAuthType() AuthType

func (*AuthRequest) GetAwsIam

func (x *AuthRequest) GetAwsIam() *AuthRequest_AwsIam

func (*AuthRequest) GetGoogleOpenId

func (x *AuthRequest) GetGoogleOpenId() *AuthRequest_GoogleOpenID

func (*AuthRequest) ProtoMessage

func (*AuthRequest) ProtoMessage()

func (*AuthRequest) ProtoReflect added in v1.1.0

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

func (*AuthRequest) Reset

func (x *AuthRequest) Reset()

func (*AuthRequest) String

func (x *AuthRequest) String() string

type AuthRequest_AwsIam

type AuthRequest_AwsIam struct {
	AccessKey       string `protobuf:"bytes,1,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"`
	SecretAccessKey string `protobuf:"bytes,2,opt,name=secret_access_key,json=secretAccessKey,proto3" json:"secret_access_key,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthRequest_AwsIam) Descriptor deprecated

This method has been deprecated.
func (*AuthRequest_AwsIam) Descriptor() ([]byte, []int)

Deprecated: Use AuthRequest_AwsIam.ProtoReflect.Descriptor instead.

func (*AuthRequest_AwsIam) GetAccessKey

func (x *AuthRequest_AwsIam) GetAccessKey() string

func (*AuthRequest_AwsIam) GetSecretAccessKey

func (x *AuthRequest_AwsIam) GetSecretAccessKey() string

func (*AuthRequest_AwsIam) ProtoMessage

func (*AuthRequest_AwsIam) ProtoMessage()

func (*AuthRequest_AwsIam) ProtoReflect added in v1.1.0

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

func (*AuthRequest_AwsIam) Reset

func (x *AuthRequest_AwsIam) Reset()

func (*AuthRequest_AwsIam) String

func (x *AuthRequest_AwsIam) String() string

type AuthRequest_GoogleOpenID

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

func (*AuthRequest_GoogleOpenID) Descriptor deprecated

This method has been deprecated.
func (*AuthRequest_GoogleOpenID) Descriptor() ([]byte, []int)

Deprecated: Use AuthRequest_GoogleOpenID.ProtoReflect.Descriptor instead.

func (*AuthRequest_GoogleOpenID) GetCode

func (x *AuthRequest_GoogleOpenID) GetCode() string

func (*AuthRequest_GoogleOpenID) ProtoMessage

func (*AuthRequest_GoogleOpenID) ProtoMessage()

func (*AuthRequest_GoogleOpenID) ProtoReflect added in v1.1.0

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

func (*AuthRequest_GoogleOpenID) Reset

func (x *AuthRequest_GoogleOpenID) Reset()

func (*AuthRequest_GoogleOpenID) String

func (x *AuthRequest_GoogleOpenID) String() string

type AuthResponse

type AuthResponse struct {
	ErrorCode ErrorCode `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,enum=vpn.ErrorCode" json:"error_code,omitempty"` // error code
	Jwt       string    `protobuf:"bytes,2,opt,name=jwt,proto3" json:"jwt,omitempty"`                                                  // jwt
	// contains filtered or unexported fields
}

func (*AuthResponse) Descriptor deprecated

This method has been deprecated.
func (*AuthResponse) Descriptor() ([]byte, []int)

Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.

func (*AuthResponse) GetErrorCode

func (x *AuthResponse) GetErrorCode() ErrorCode

func (*AuthResponse) GetJwt

func (x *AuthResponse) GetJwt() string

func (*AuthResponse) ProtoMessage

func (*AuthResponse) ProtoMessage()

func (*AuthResponse) ProtoReflect added in v1.1.0

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

func (*AuthResponse) Reset

func (x *AuthResponse) Reset()

func (*AuthResponse) String

func (x *AuthResponse) String() string

type AuthType

type AuthType int32
const (
	AuthType_AT_NONE           AuthType = 0 // unknown
	AuthType_AT_TEST           AuthType = 1 // test
	AuthType_AT_GOOGLE_OPEN_ID AuthType = 2 // google open id
	AuthType_AT_AWS_IAM        AuthType = 3 // aws iam
)

func (AuthType) Descriptor added in v1.1.0

func (AuthType) Descriptor() protoreflect.EnumDescriptor

func (AuthType) Enum added in v1.1.0

func (x AuthType) Enum() *AuthType

func (AuthType) EnumDescriptor deprecated

This method has been deprecated.
func (AuthType) EnumDescriptor() ([]byte, []int)

Deprecated: Use AuthType.Descriptor instead.

func (AuthType) Number added in v1.1.0

func (x AuthType) Number() protoreflect.EnumNumber

func (AuthType) String

func (x AuthType) String() string

func (AuthType) Type added in v1.1.0

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_EC_UNKNOWN               ErrorCode = 0
	ErrorCode_EC_SUCCESS               ErrorCode = 1
	ErrorCode_EC_INVALID_AUTHORIZATION ErrorCode = 2
	ErrorCode_EC_EXPIRED_JWT           ErrorCode = 3
)

func (ErrorCode) Descriptor added in v1.1.0

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum added in v1.1.0

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

This method has been deprecated.
func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number added in v1.1.0

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type added in v1.1.0

type IPPacket

type IPPacket struct {
	ErrorCode  ErrorCode     `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,enum=vpn.ErrorCode" json:"error_code,omitempty"`       // error code
	PacketType IPPacketType  `protobuf:"varint,2,opt,name=packet_type,json=packetType,proto3,enum=vpn.IPPacketType" json:"packet_type,omitempty"` // packet type
	Packet1    *IPPacket_Raw `protobuf:"bytes,10,opt,name=packet1,proto3" json:"packet1,omitempty"`                                               // raw packet
	Packet2    *IPPacket_Vpn `protobuf:"bytes,11,opt,name=packet2,proto3" json:"packet2,omitempty"`                                               // vpn packet
	// contains filtered or unexported fields
}

func (*IPPacket) Descriptor deprecated

This method has been deprecated.
func (*IPPacket) Descriptor() ([]byte, []int)

Deprecated: Use IPPacket.ProtoReflect.Descriptor instead.

func (*IPPacket) GetErrorCode

func (x *IPPacket) GetErrorCode() ErrorCode

func (*IPPacket) GetPacket1

func (x *IPPacket) GetPacket1() *IPPacket_Raw

func (*IPPacket) GetPacket2

func (x *IPPacket) GetPacket2() *IPPacket_Vpn

func (*IPPacket) GetPacketType

func (x *IPPacket) GetPacketType() IPPacketType

func (*IPPacket) ProtoMessage

func (*IPPacket) ProtoMessage()

func (*IPPacket) ProtoReflect added in v1.1.0

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

func (*IPPacket) Reset

func (x *IPPacket) Reset()

func (*IPPacket) String

func (x *IPPacket) String() string

type IPPacketType

type IPPacketType int32
const (
	IPPacketType_IPPT_UNKNOWN    IPPacketType = 0
	IPPacketType_IPPT_RAW        IPPacketType = 1
	IPPacketType_IPPT_VPN_ASSIGN IPPacketType = 2
)

func (IPPacketType) Descriptor added in v1.1.0

func (IPPacketType) Enum added in v1.1.0

func (x IPPacketType) Enum() *IPPacketType

func (IPPacketType) EnumDescriptor deprecated

This method has been deprecated.
func (IPPacketType) EnumDescriptor() ([]byte, []int)

Deprecated: Use IPPacketType.Descriptor instead.

func (IPPacketType) Number added in v1.1.0

func (IPPacketType) String

func (x IPPacketType) String() string

func (IPPacketType) Type added in v1.1.0

type IPPacket_Raw

type IPPacket_Raw struct {
	Raw []byte `protobuf:"bytes,1,opt,name=raw,proto3" json:"raw,omitempty"` // raw packet
	// contains filtered or unexported fields
}

func (*IPPacket_Raw) Descriptor deprecated

This method has been deprecated.
func (*IPPacket_Raw) Descriptor() ([]byte, []int)

Deprecated: Use IPPacket_Raw.ProtoReflect.Descriptor instead.

func (*IPPacket_Raw) GetRaw

func (x *IPPacket_Raw) GetRaw() []byte

func (*IPPacket_Raw) ProtoMessage

func (*IPPacket_Raw) ProtoMessage()

func (*IPPacket_Raw) ProtoReflect added in v1.1.0

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

func (*IPPacket_Raw) Reset

func (x *IPPacket_Raw) Reset()

func (*IPPacket_Raw) String

func (x *IPPacket_Raw) String() string

type IPPacket_Vpn

type IPPacket_Vpn struct {
	VpnAssignedIp []byte `protobuf:"bytes,1,opt,name=vpn_assigned_ip,json=vpnAssignedIp,proto3" json:"vpn_assigned_ip,omitempty"` // vpn  assigned ip
	VpnGateway    []byte `protobuf:"bytes,2,opt,name=vpn_gateway,json=vpnGateway,proto3" json:"vpn_gateway,omitempty"`            // vpn gateway
	VpnSubnetIp   []byte `protobuf:"bytes,3,opt,name=vpn_subnet_ip,json=vpnSubnetIp,proto3" json:"vpn_subnet_ip,omitempty"`       // vpn subnet ip
	VpnSubnetMask []byte `protobuf:"bytes,4,opt,name=vpn_subnet_mask,json=vpnSubnetMask,proto3" json:"vpn_subnet_mask,omitempty"` // vpn subnet mask
	// contains filtered or unexported fields
}

func (*IPPacket_Vpn) Descriptor deprecated

This method has been deprecated.
func (*IPPacket_Vpn) Descriptor() ([]byte, []int)

Deprecated: Use IPPacket_Vpn.ProtoReflect.Descriptor instead.

func (*IPPacket_Vpn) GetVpnAssignedIp

func (x *IPPacket_Vpn) GetVpnAssignedIp() []byte

func (*IPPacket_Vpn) GetVpnGateway

func (x *IPPacket_Vpn) GetVpnGateway() []byte

func (*IPPacket_Vpn) GetVpnSubnetIp

func (x *IPPacket_Vpn) GetVpnSubnetIp() []byte

func (*IPPacket_Vpn) GetVpnSubnetMask

func (x *IPPacket_Vpn) GetVpnSubnetMask() []byte

func (*IPPacket_Vpn) ProtoMessage

func (*IPPacket_Vpn) ProtoMessage()

func (*IPPacket_Vpn) ProtoReflect added in v1.1.0

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

func (*IPPacket_Vpn) Reset

func (x *IPPacket_Vpn) Reset()

func (*IPPacket_Vpn) String

func (x *IPPacket_Vpn) String() string

type UnimplementedVPNServer

type UnimplementedVPNServer struct {
}

UnimplementedVPNServer can be embedded to have forward compatible implementations.

func (*UnimplementedVPNServer) Auth

func (*UnimplementedVPNServer) Exchange

type VPNClient

type VPNClient interface {
	// authentication
	Auth(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
	// exchange packets
	Exchange(ctx context.Context, opts ...grpc.CallOption) (VPN_ExchangeClient, error)
}

VPNClient is the client API for VPN service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewVPNClient

func NewVPNClient(cc grpc.ClientConnInterface) VPNClient

type VPNServer

type VPNServer interface {
	// authentication
	Auth(context.Context, *AuthRequest) (*AuthResponse, error)
	// exchange packets
	Exchange(VPN_ExchangeServer) error
}

VPNServer is the server API for VPN service.

type VPN_ExchangeClient

type VPN_ExchangeClient interface {
	Send(*IPPacket) error
	Recv() (*IPPacket, error)
	grpc.ClientStream
}

type VPN_ExchangeServer

type VPN_ExchangeServer interface {
	Send(*IPPacket) error
	Recv() (*IPPacket, error)
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL