spamcheck

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package spamcheck is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Action_name = map[int32]string{
		0: "CREATE",
		1: "UPDATE",
	}
	Action_value = map[string]int32{
		"CREATE": 0,
		"UPDATE": 1,
	}
)

Enum value maps for Action.

View Source
var (
	SpamVerdict_Verdict_name = map[int32]string{
		0: "ALLOW",
		1: "CONDITIONAL_ALLOW",
		2: "DISALLOW",
		3: "BLOCK",
		4: "NOOP",
	}
	SpamVerdict_Verdict_value = map[string]int32{
		"ALLOW":             0,
		"CONDITIONAL_ALLOW": 1,
		"DISALLOW":          2,
		"BLOCK":             3,
		"NOOP":              4,
	}
)

Enum value maps for SpamVerdict_Verdict.

View Source
var File_spamcheck_proto protoreflect.FileDescriptor

Functions

func RegisterSpamcheckServiceHandler

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

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

func RegisterSpamcheckServiceHandlerClient

func RegisterSpamcheckServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SpamcheckServiceClient) error

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

func RegisterSpamcheckServiceHandlerFromEndpoint

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

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

func RegisterSpamcheckServiceHandlerServer

func RegisterSpamcheckServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SpamcheckServiceServer) error

RegisterSpamcheckServiceHandlerServer registers the http handlers for service SpamcheckService to "mux". UnaryRPC :call SpamcheckServiceServer 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 RegisterSpamcheckServiceHandlerFromEndpoint instead.

func RegisterSpamcheckServiceServer

func RegisterSpamcheckServiceServer(s grpc.ServiceRegistrar, srv SpamcheckServiceServer)

Types

type Action

type Action int32
const (
	Action_CREATE Action = 0
	Action_UPDATE Action = 1
)

func (Action) Descriptor

func (Action) Descriptor() protoreflect.EnumDescriptor

func (Action) Enum

func (x Action) Enum() *Action

func (Action) EnumDescriptor deprecated

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

Deprecated: Use Action.Descriptor instead.

func (Action) Number

func (x Action) Number() protoreflect.EnumNumber

func (Action) String

func (x Action) String() string

func (Action) Type

func (Action) Type() protoreflect.EnumType

type Issue

type Issue struct {
	User          *User                  `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Title         string                 `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Description   string                 `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	CreatedAt     *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt     *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	Action        Action                 `protobuf:"varint,6,opt,name=action,proto3,enum=spamcheck.Action" json:"action,omitempty"`
	UserInProject bool                   `protobuf:"varint,7,opt,name=user_in_project,json=userInProject,proto3" json:"user_in_project,omitempty"` // Whether or not the user is an authorized project member
	Project       *Project               `protobuf:"bytes,8,opt,name=project,proto3" json:"project,omitempty"`
	// contains filtered or unexported fields
}

func (*Issue) Descriptor deprecated

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

Deprecated: Use Issue.ProtoReflect.Descriptor instead.

func (*Issue) GetAction

func (x *Issue) GetAction() Action

func (*Issue) GetCreatedAt

func (x *Issue) GetCreatedAt() *timestamppb.Timestamp

func (*Issue) GetDescription

func (x *Issue) GetDescription() string

func (*Issue) GetProject

func (x *Issue) GetProject() *Project

func (*Issue) GetTitle

func (x *Issue) GetTitle() string

func (*Issue) GetUpdatedAt

func (x *Issue) GetUpdatedAt() *timestamppb.Timestamp

func (*Issue) GetUser

func (x *Issue) GetUser() *User

func (*Issue) GetUserInProject

func (x *Issue) GetUserInProject() bool

func (*Issue) ProtoMessage

func (*Issue) ProtoMessage()

func (*Issue) ProtoReflect

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

func (*Issue) Reset

func (x *Issue) Reset()

func (*Issue) String

func (x *Issue) String() string

type Project

type Project struct {
	ProjectId   int32  `protobuf:"varint,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"`
	ProjectPath string `protobuf:"bytes,2,opt,name=project_path,json=projectPath,proto3" json:"project_path,omitempty"`
	// contains filtered or unexported fields
}

func (*Project) Descriptor deprecated

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

Deprecated: Use Project.ProtoReflect.Descriptor instead.

func (*Project) GetProjectId

func (x *Project) GetProjectId() int32

func (*Project) GetProjectPath

func (x *Project) GetProjectPath() string

func (*Project) ProtoMessage

func (*Project) ProtoMessage()

func (*Project) ProtoReflect

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

func (*Project) Reset

func (x *Project) Reset()

func (*Project) String

func (x *Project) String() string

type SpamVerdict

type SpamVerdict struct {
	Verdict         SpamVerdict_Verdict `protobuf:"varint,1,opt,name=verdict,proto3,enum=spamcheck.SpamVerdict_Verdict" json:"verdict,omitempty"`
	Error           string              `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	ExtraAttributes map[string]string   `` /* 194-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SpamVerdict) Descriptor deprecated

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

Deprecated: Use SpamVerdict.ProtoReflect.Descriptor instead.

func (*SpamVerdict) GetError

func (x *SpamVerdict) GetError() string

func (*SpamVerdict) GetExtraAttributes

func (x *SpamVerdict) GetExtraAttributes() map[string]string

func (*SpamVerdict) GetVerdict

func (x *SpamVerdict) GetVerdict() SpamVerdict_Verdict

func (*SpamVerdict) ProtoMessage

func (*SpamVerdict) ProtoMessage()

func (*SpamVerdict) ProtoReflect

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

func (*SpamVerdict) Reset

func (x *SpamVerdict) Reset()

func (*SpamVerdict) String

func (x *SpamVerdict) String() string

type SpamVerdict_Verdict

type SpamVerdict_Verdict int32
const (
	SpamVerdict_ALLOW             SpamVerdict_Verdict = 0
	SpamVerdict_CONDITIONAL_ALLOW SpamVerdict_Verdict = 1
	SpamVerdict_DISALLOW          SpamVerdict_Verdict = 2
	SpamVerdict_BLOCK             SpamVerdict_Verdict = 3
	SpamVerdict_NOOP              SpamVerdict_Verdict = 4
)

func (SpamVerdict_Verdict) Descriptor

func (SpamVerdict_Verdict) Enum

func (SpamVerdict_Verdict) EnumDescriptor deprecated

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

Deprecated: Use SpamVerdict_Verdict.Descriptor instead.

func (SpamVerdict_Verdict) Number

func (SpamVerdict_Verdict) String

func (x SpamVerdict_Verdict) String() string

func (SpamVerdict_Verdict) Type

type SpamcheckServiceClient

type SpamcheckServiceClient interface {
	CheckForSpamIssue(ctx context.Context, in *Issue, opts ...grpc.CallOption) (*SpamVerdict, error)
	Healthz(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

SpamcheckServiceClient is the client API for SpamcheckService 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.

type SpamcheckServiceServer

type SpamcheckServiceServer interface {
	CheckForSpamIssue(context.Context, *Issue) (*SpamVerdict, error)
	Healthz(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

SpamcheckServiceServer is the server API for SpamcheckService service. All implementations must embed UnimplementedSpamcheckServiceServer for forward compatibility

type UnimplementedSpamcheckServiceServer

type UnimplementedSpamcheckServiceServer struct {
}

UnimplementedSpamcheckServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedSpamcheckServiceServer) CheckForSpamIssue

func (UnimplementedSpamcheckServiceServer) Healthz

type UnsafeSpamcheckServiceServer

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

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

type User

type User struct {
	Emails    []*User_Email          `protobuf:"bytes,1,rep,name=emails,proto3" json:"emails,omitempty"`
	Org       string                 `protobuf:"bytes,2,opt,name=org,proto3" json:"org,omitempty"`
	Username  string                 `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreatedAt

func (x *User) GetCreatedAt() *timestamppb.Timestamp

func (*User) GetEmails

func (x *User) GetEmails() []*User_Email

func (*User) GetOrg

func (x *User) GetOrg() string

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type User_Email

type User_Email struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Verified bool   `protobuf:"varint,2,opt,name=verified,proto3" json:"verified,omitempty"`
	// contains filtered or unexported fields
}

func (*User_Email) Descriptor deprecated

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

Deprecated: Use User_Email.ProtoReflect.Descriptor instead.

func (*User_Email) GetEmail

func (x *User_Email) GetEmail() string

func (*User_Email) GetVerified

func (x *User_Email) GetVerified() bool

func (*User_Email) ProtoMessage

func (*User_Email) ProtoMessage()

func (*User_Email) ProtoReflect

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

func (*User_Email) Reset

func (x *User_Email) Reset()

func (*User_Email) String

func (x *User_Email) String() string

Jump to

Keyboard shortcuts

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