v2

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

Package v2 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Location_Type_name = map[int32]string{
		0: "TYPE_IP_UNSPECIFIED",
		1: "TYPE_GEO",
	}
	Location_Type_value = map[string]int32{
		"TYPE_IP_UNSPECIFIED": 0,
		"TYPE_GEO":            1,
	}
)

Enum value maps for Location_Type.

View Source
var File_standort_v2_service_proto protoreflect.FileDescriptor
View Source
var Service_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "standort.v2.Service",
	HandlerType: (*ServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetLocation",
			Handler:    _Service_GetLocation_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "standort/v2/service.proto",
}

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

Functions

func RegisterServiceHandler

func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterServiceHandler registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterServiceHandlerClient

func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error

RegisterServiceHandlerClient registers the http handlers for service Service to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ServiceClient" to call the correct interceptors.

func RegisterServiceHandlerFromEndpoint

func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterServiceHandlerServer

func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error

RegisterServiceHandlerServer registers the http handlers for service Service to "mux". UnaryRPC :call ServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceHandlerFromEndpoint instead.

func RegisterServiceServer

func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)

Types

type GetLocationRequest

type GetLocationRequest struct {
	Ip    string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
	Point *Point `protobuf:"bytes,2,opt,name=point,proto3" json:"point,omitempty"`
	// contains filtered or unexported fields
}

GetLocationRequest for getting the location.

func (*GetLocationRequest) Descriptor deprecated

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

Deprecated: Use GetLocationRequest.ProtoReflect.Descriptor instead.

func (*GetLocationRequest) GetIp

func (x *GetLocationRequest) GetIp() string

func (*GetLocationRequest) GetPoint

func (x *GetLocationRequest) GetPoint() *Point

func (*GetLocationRequest) ProtoMessage

func (*GetLocationRequest) ProtoMessage()

func (*GetLocationRequest) ProtoReflect

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

func (*GetLocationRequest) Reset

func (x *GetLocationRequest) Reset()

func (*GetLocationRequest) String

func (x *GetLocationRequest) String() string

type GetLocationResponse

type GetLocationResponse struct {
	Locations []*Location `protobuf:"bytes,1,rep,name=locations,proto3" json:"locations,omitempty"`
	// contains filtered or unexported fields
}

GetLocationResponse for getting the location.

func (*GetLocationResponse) Descriptor deprecated

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

Deprecated: Use GetLocationResponse.ProtoReflect.Descriptor instead.

func (*GetLocationResponse) GetLocations

func (x *GetLocationResponse) GetLocations() []*Location

func (*GetLocationResponse) ProtoMessage

func (*GetLocationResponse) ProtoMessage()

func (*GetLocationResponse) ProtoReflect

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

func (*GetLocationResponse) Reset

func (x *GetLocationResponse) Reset()

func (*GetLocationResponse) String

func (x *GetLocationResponse) String() string

type Location

type Location struct {
	Type      Location_Type `protobuf:"varint,1,opt,name=type,proto3,enum=standort.v2.Location_Type" json:"type,omitempty"`
	Country   string        `protobuf:"bytes,2,opt,name=country,proto3" json:"country,omitempty"`
	Continent string        `protobuf:"bytes,3,opt,name=continent,proto3" json:"continent,omitempty"`
	// contains filtered or unexported fields
}

Location of the response.

func (*Location) Descriptor deprecated

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

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetContinent

func (x *Location) GetContinent() string

func (*Location) GetCountry

func (x *Location) GetCountry() string

func (*Location) GetType

func (x *Location) GetType() Location_Type

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

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

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

type Location_Type

type Location_Type int32
const (
	Location_TYPE_IP_UNSPECIFIED Location_Type = 0
	Location_TYPE_GEO            Location_Type = 1
)

func (Location_Type) Descriptor

func (Location_Type) Enum

func (x Location_Type) Enum() *Location_Type

func (Location_Type) EnumDescriptor deprecated

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

Deprecated: Use Location_Type.Descriptor instead.

func (Location_Type) Number

func (Location_Type) String

func (x Location_Type) String() string

func (Location_Type) Type

type Point

type Point struct {
	Lat float64 `protobuf:"fixed64,1,opt,name=lat,proto3" json:"lat,omitempty"`
	Lng float64 `protobuf:"fixed64,2,opt,name=lng,proto3" json:"lng,omitempty"`
	// contains filtered or unexported fields
}

Point for the request.

func (*Point) Descriptor deprecated

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

Deprecated: Use Point.ProtoReflect.Descriptor instead.

func (*Point) GetLat

func (x *Point) GetLat() float64

func (*Point) GetLng

func (x *Point) GetLng() float64

func (*Point) ProtoMessage

func (*Point) ProtoMessage()

func (*Point) ProtoReflect

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

func (*Point) Reset

func (x *Point) Reset()

func (*Point) String

func (x *Point) String() string

type ServiceClient

type ServiceClient interface {
	// GetLocation via multiple methods.
	GetLocation(ctx context.Context, in *GetLocationRequest, opts ...grpc.CallOption) (*GetLocationResponse, error)
}

ServiceClient is the client API for Service 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 NewServiceClient

func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient

type ServiceServer

type ServiceServer interface {
	// GetLocation via multiple methods.
	GetLocation(context.Context, *GetLocationRequest) (*GetLocationResponse, error)
	// contains filtered or unexported methods
}

ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility

type UnimplementedServiceServer

type UnimplementedServiceServer struct {
}

UnimplementedServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedServiceServer) GetLocation

type UnsafeServiceServer

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

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

Jump to

Keyboard shortcuts

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