api

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetUserRequest_Operation_name = map[int32]string{
	0: "Add",
	1: "Delete",
	2: "Modify",
}
View Source
var SetUserRequest_Operation_value = map[string]int32{
	"Add":    0,
	"Delete": 1,
	"Modify": 2,
}

Functions

func RegisterTrojanClientServiceServer added in v0.4.3

func RegisterTrojanClientServiceServer(s *grpc.Server, srv TrojanClientServiceServer)

func RegisterTrojanServerServiceServer added in v0.4.3

func RegisterTrojanServerServiceServer(s *grpc.Server, srv TrojanServerServiceServer)

func RunClientAPI added in v0.4.3

func RunClientAPI(ctx context.Context, config *conf.GlobalConfig, auth stat.Authenticator) error

func RunServerAPI added in v0.4.3

func RunServerAPI(ctx context.Context, config *conf.GlobalConfig, auth stat.Authenticator) error

Types

type ClientAPI added in v0.4.3

type ClientAPI struct {
	TrojanClientServiceServer
	// contains filtered or unexported fields
}

func (*ClientAPI) GetTraffic added in v0.4.3

func (s *ClientAPI) GetTraffic(ctx context.Context, req *GetTrafficRequest) (*GetTrafficResponse, error)

type GetTrafficRequest added in v0.4.3

type GetTrafficRequest struct {
	User                 *User    `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetTrafficRequest) Descriptor added in v0.4.3

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

func (*GetTrafficRequest) GetUser added in v0.4.3

func (m *GetTrafficRequest) GetUser() *User

func (*GetTrafficRequest) ProtoMessage added in v0.4.3

func (*GetTrafficRequest) ProtoMessage()

func (*GetTrafficRequest) Reset added in v0.4.3

func (m *GetTrafficRequest) Reset()

func (*GetTrafficRequest) String added in v0.4.3

func (m *GetTrafficRequest) String() string

func (*GetTrafficRequest) XXX_DiscardUnknown added in v0.4.3

func (m *GetTrafficRequest) XXX_DiscardUnknown()

func (*GetTrafficRequest) XXX_Marshal added in v0.4.3

func (m *GetTrafficRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTrafficRequest) XXX_Merge added in v0.4.3

func (m *GetTrafficRequest) XXX_Merge(src proto.Message)

func (*GetTrafficRequest) XXX_Size added in v0.4.3

func (m *GetTrafficRequest) XXX_Size() int

func (*GetTrafficRequest) XXX_Unmarshal added in v0.4.3

func (m *GetTrafficRequest) XXX_Unmarshal(b []byte) error

type GetTrafficResponse added in v0.4.3

type GetTrafficResponse struct {
	Success              bool     `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	TrafficTotal         *Traffic `protobuf:"bytes,2,opt,name=traffic_total,json=trafficTotal,proto3" json:"traffic_total,omitempty"`
	SpeedCurrent         *Speed   `protobuf:"bytes,3,opt,name=speed_current,json=speedCurrent,proto3" json:"speed_current,omitempty"`
	SpeedLimit           *Speed   `protobuf:"bytes,4,opt,name=speed_limit,json=speedLimit,proto3" json:"speed_limit,omitempty"`
	Info                 string   `protobuf:"bytes,5,opt,name=info,proto3" json:"info,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetTrafficResponse) Descriptor added in v0.4.3

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

func (*GetTrafficResponse) GetInfo added in v0.4.3

func (m *GetTrafficResponse) GetInfo() string

func (*GetTrafficResponse) GetSpeedCurrent added in v0.4.3

func (m *GetTrafficResponse) GetSpeedCurrent() *Speed

func (*GetTrafficResponse) GetSpeedLimit added in v0.4.3

func (m *GetTrafficResponse) GetSpeedLimit() *Speed

func (*GetTrafficResponse) GetSuccess added in v0.4.3

func (m *GetTrafficResponse) GetSuccess() bool

func (*GetTrafficResponse) GetTrafficTotal added in v0.4.3

func (m *GetTrafficResponse) GetTrafficTotal() *Traffic

func (*GetTrafficResponse) ProtoMessage added in v0.4.3

func (*GetTrafficResponse) ProtoMessage()

func (*GetTrafficResponse) Reset added in v0.4.3

func (m *GetTrafficResponse) Reset()

func (*GetTrafficResponse) String added in v0.4.3

func (m *GetTrafficResponse) String() string

func (*GetTrafficResponse) XXX_DiscardUnknown added in v0.4.3

func (m *GetTrafficResponse) XXX_DiscardUnknown()

func (*GetTrafficResponse) XXX_Marshal added in v0.4.3

func (m *GetTrafficResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTrafficResponse) XXX_Merge added in v0.4.3

func (m *GetTrafficResponse) XXX_Merge(src proto.Message)

func (*GetTrafficResponse) XXX_Size added in v0.4.3

func (m *GetTrafficResponse) XXX_Size() int

func (*GetTrafficResponse) XXX_Unmarshal added in v0.4.3

func (m *GetTrafficResponse) XXX_Unmarshal(b []byte) error

type ListUserRequest added in v0.4.3

type ListUserRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListUserRequest) Descriptor added in v0.4.3

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

func (*ListUserRequest) ProtoMessage added in v0.4.3

func (*ListUserRequest) ProtoMessage()

func (*ListUserRequest) Reset added in v0.4.3

func (m *ListUserRequest) Reset()

func (*ListUserRequest) String added in v0.4.3

func (m *ListUserRequest) String() string

func (*ListUserRequest) XXX_DiscardUnknown added in v0.4.3

func (m *ListUserRequest) XXX_DiscardUnknown()

func (*ListUserRequest) XXX_Marshal added in v0.4.3

func (m *ListUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListUserRequest) XXX_Merge added in v0.4.3

func (m *ListUserRequest) XXX_Merge(src proto.Message)

func (*ListUserRequest) XXX_Size added in v0.4.3

func (m *ListUserRequest) XXX_Size() int

func (*ListUserRequest) XXX_Unmarshal added in v0.4.3

func (m *ListUserRequest) XXX_Unmarshal(b []byte) error

type ListUserResponse added in v0.4.3

type ListUserResponse struct {
	User                 *User    `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Online               bool     `protobuf:"varint,2,opt,name=online,proto3" json:"online,omitempty"`
	TrafficTotal         *Traffic `protobuf:"bytes,3,opt,name=traffic_total,json=trafficTotal,proto3" json:"traffic_total,omitempty"`
	SpeedCurrent         *Speed   `protobuf:"bytes,4,opt,name=speed_current,json=speedCurrent,proto3" json:"speed_current,omitempty"`
	SpeedLimit           *Speed   `protobuf:"bytes,5,opt,name=speed_limit,json=speedLimit,proto3" json:"speed_limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ListUserResponse) Descriptor added in v0.4.3

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

func (*ListUserResponse) GetOnline added in v0.4.3

func (m *ListUserResponse) GetOnline() bool

func (*ListUserResponse) GetSpeedCurrent added in v0.4.3

func (m *ListUserResponse) GetSpeedCurrent() *Speed

func (*ListUserResponse) GetSpeedLimit added in v0.4.3

func (m *ListUserResponse) GetSpeedLimit() *Speed

func (*ListUserResponse) GetTrafficTotal added in v0.4.3

func (m *ListUserResponse) GetTrafficTotal() *Traffic

func (*ListUserResponse) GetUser added in v0.4.3

func (m *ListUserResponse) GetUser() *User

func (*ListUserResponse) ProtoMessage added in v0.4.3

func (*ListUserResponse) ProtoMessage()

func (*ListUserResponse) Reset added in v0.4.3

func (m *ListUserResponse) Reset()

func (*ListUserResponse) String added in v0.4.3

func (m *ListUserResponse) String() string

func (*ListUserResponse) XXX_DiscardUnknown added in v0.4.3

func (m *ListUserResponse) XXX_DiscardUnknown()

func (*ListUserResponse) XXX_Marshal added in v0.4.3

func (m *ListUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListUserResponse) XXX_Merge added in v0.4.3

func (m *ListUserResponse) XXX_Merge(src proto.Message)

func (*ListUserResponse) XXX_Size added in v0.4.3

func (m *ListUserResponse) XXX_Size() int

func (*ListUserResponse) XXX_Unmarshal added in v0.4.3

func (m *ListUserResponse) XXX_Unmarshal(b []byte) error

type ServerAPI added in v0.4.3

type ServerAPI struct {
	TrojanServerServiceServer
	// contains filtered or unexported fields
}

func (*ServerAPI) GetTraffic added in v0.4.3

func (*ServerAPI) ListUsers added in v0.4.3

func (*ServerAPI) SetUsers added in v0.4.3

type SetUserRequest added in v0.4.3

type SetUserRequest struct {
	User                 *User                    `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	SpeedLimit           *Speed                   `protobuf:"bytes,2,opt,name=speed_limit,json=speedLimit,proto3" json:"speed_limit,omitempty"`
	Operation            SetUserRequest_Operation `protobuf:"varint,3,opt,name=operation,proto3,enum=trojan.api.SetUserRequest_Operation" json:"operation,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
	XXX_unrecognized     []byte                   `json:"-"`
	XXX_sizecache        int32                    `json:"-"`
}

func (*SetUserRequest) Descriptor added in v0.4.3

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

func (*SetUserRequest) GetOperation added in v0.4.3

func (m *SetUserRequest) GetOperation() SetUserRequest_Operation

func (*SetUserRequest) GetSpeedLimit added in v0.4.3

func (m *SetUserRequest) GetSpeedLimit() *Speed

func (*SetUserRequest) GetUser added in v0.4.3

func (m *SetUserRequest) GetUser() *User

func (*SetUserRequest) ProtoMessage added in v0.4.3

func (*SetUserRequest) ProtoMessage()

func (*SetUserRequest) Reset added in v0.4.3

func (m *SetUserRequest) Reset()

func (*SetUserRequest) String added in v0.4.3

func (m *SetUserRequest) String() string

func (*SetUserRequest) XXX_DiscardUnknown added in v0.4.3

func (m *SetUserRequest) XXX_DiscardUnknown()

func (*SetUserRequest) XXX_Marshal added in v0.4.3

func (m *SetUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetUserRequest) XXX_Merge added in v0.4.3

func (m *SetUserRequest) XXX_Merge(src proto.Message)

func (*SetUserRequest) XXX_Size added in v0.4.3

func (m *SetUserRequest) XXX_Size() int

func (*SetUserRequest) XXX_Unmarshal added in v0.4.3

func (m *SetUserRequest) XXX_Unmarshal(b []byte) error

type SetUserRequest_Operation added in v0.4.3

type SetUserRequest_Operation int32
const (
	SetUserRequest_Add    SetUserRequest_Operation = 0
	SetUserRequest_Delete SetUserRequest_Operation = 1
	SetUserRequest_Modify SetUserRequest_Operation = 2
)

func (SetUserRequest_Operation) EnumDescriptor added in v0.4.3

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

func (SetUserRequest_Operation) String added in v0.4.3

func (x SetUserRequest_Operation) String() string

type SetUserResponse added in v0.4.3

type SetUserResponse struct {
	Success              bool     `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	Info                 string   `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SetUserResponse) Descriptor added in v0.4.3

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

func (*SetUserResponse) GetInfo added in v0.4.3

func (m *SetUserResponse) GetInfo() string

func (*SetUserResponse) GetSuccess added in v0.4.3

func (m *SetUserResponse) GetSuccess() bool

func (*SetUserResponse) ProtoMessage added in v0.4.3

func (*SetUserResponse) ProtoMessage()

func (*SetUserResponse) Reset added in v0.4.3

func (m *SetUserResponse) Reset()

func (*SetUserResponse) String added in v0.4.3

func (m *SetUserResponse) String() string

func (*SetUserResponse) XXX_DiscardUnknown added in v0.4.3

func (m *SetUserResponse) XXX_DiscardUnknown()

func (*SetUserResponse) XXX_Marshal added in v0.4.3

func (m *SetUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetUserResponse) XXX_Merge added in v0.4.3

func (m *SetUserResponse) XXX_Merge(src proto.Message)

func (*SetUserResponse) XXX_Size added in v0.4.3

func (m *SetUserResponse) XXX_Size() int

func (*SetUserResponse) XXX_Unmarshal added in v0.4.3

func (m *SetUserResponse) XXX_Unmarshal(b []byte) error

type Speed added in v0.4.3

type Speed struct {
	UploadSpeed          uint64   `protobuf:"varint,1,opt,name=upload_speed,json=uploadSpeed,proto3" json:"upload_speed,omitempty"`
	DownloadSpeed        uint64   `protobuf:"varint,2,opt,name=download_speed,json=downloadSpeed,proto3" json:"download_speed,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Speed) Descriptor added in v0.4.3

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

func (*Speed) GetDownloadSpeed added in v0.4.3

func (m *Speed) GetDownloadSpeed() uint64

func (*Speed) GetUploadSpeed added in v0.4.3

func (m *Speed) GetUploadSpeed() uint64

func (*Speed) ProtoMessage added in v0.4.3

func (*Speed) ProtoMessage()

func (*Speed) Reset added in v0.4.3

func (m *Speed) Reset()

func (*Speed) String added in v0.4.3

func (m *Speed) String() string

func (*Speed) XXX_DiscardUnknown added in v0.4.3

func (m *Speed) XXX_DiscardUnknown()

func (*Speed) XXX_Marshal added in v0.4.3

func (m *Speed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Speed) XXX_Merge added in v0.4.3

func (m *Speed) XXX_Merge(src proto.Message)

func (*Speed) XXX_Size added in v0.4.3

func (m *Speed) XXX_Size() int

func (*Speed) XXX_Unmarshal added in v0.4.3

func (m *Speed) XXX_Unmarshal(b []byte) error

type Traffic added in v0.4.3

type Traffic struct {
	UploadTraffic        uint64   `protobuf:"varint,1,opt,name=upload_traffic,json=uploadTraffic,proto3" json:"upload_traffic,omitempty"`
	DownloadTraffic      uint64   `protobuf:"varint,2,opt,name=download_traffic,json=downloadTraffic,proto3" json:"download_traffic,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Traffic) Descriptor added in v0.4.3

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

func (*Traffic) GetDownloadTraffic added in v0.4.3

func (m *Traffic) GetDownloadTraffic() uint64

func (*Traffic) GetUploadTraffic added in v0.4.3

func (m *Traffic) GetUploadTraffic() uint64

func (*Traffic) ProtoMessage added in v0.4.3

func (*Traffic) ProtoMessage()

func (*Traffic) Reset added in v0.4.3

func (m *Traffic) Reset()

func (*Traffic) String added in v0.4.3

func (m *Traffic) String() string

func (*Traffic) XXX_DiscardUnknown added in v0.4.3

func (m *Traffic) XXX_DiscardUnknown()

func (*Traffic) XXX_Marshal added in v0.4.3

func (m *Traffic) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Traffic) XXX_Merge added in v0.4.3

func (m *Traffic) XXX_Merge(src proto.Message)

func (*Traffic) XXX_Size added in v0.4.3

func (m *Traffic) XXX_Size() int

func (*Traffic) XXX_Unmarshal added in v0.4.3

func (m *Traffic) XXX_Unmarshal(b []byte) error

type TrojanClientServiceClient added in v0.4.3

type TrojanClientServiceClient interface {
	GetTraffic(ctx context.Context, in *GetTrafficRequest, opts ...grpc.CallOption) (*GetTrafficResponse, error)
}

TrojanClientServiceClient is the client API for TrojanClientService service.

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

func NewTrojanClientServiceClient added in v0.4.3

func NewTrojanClientServiceClient(cc grpc.ClientConnInterface) TrojanClientServiceClient

type TrojanClientServiceServer added in v0.4.3

type TrojanClientServiceServer interface {
	GetTraffic(context.Context, *GetTrafficRequest) (*GetTrafficResponse, error)
}

TrojanClientServiceServer is the server API for TrojanClientService service.

type TrojanServerServiceClient added in v0.4.3

type TrojanServerServiceClient interface {
	ListUsers(ctx context.Context, in *ListUserRequest, opts ...grpc.CallOption) (TrojanServerService_ListUsersClient, error)
	GetTraffic(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_GetTrafficClient, error)
	SetUsers(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_SetUsersClient, error)
}

TrojanServerServiceClient is the client API for TrojanServerService service.

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

func NewTrojanServerServiceClient added in v0.4.3

func NewTrojanServerServiceClient(cc grpc.ClientConnInterface) TrojanServerServiceClient

type TrojanServerServiceServer added in v0.4.3

TrojanServerServiceServer is the server API for TrojanServerService service.

type TrojanServerService_GetTrafficClient added in v0.4.3

type TrojanServerService_GetTrafficClient interface {
	Send(*GetTrafficRequest) error
	Recv() (*GetTrafficResponse, error)
	grpc.ClientStream
}

type TrojanServerService_GetTrafficServer added in v0.4.3

type TrojanServerService_GetTrafficServer interface {
	Send(*GetTrafficResponse) error
	Recv() (*GetTrafficRequest, error)
	grpc.ServerStream
}

type TrojanServerService_ListUsersClient added in v0.4.3

type TrojanServerService_ListUsersClient interface {
	Recv() (*ListUserResponse, error)
	grpc.ClientStream
}

type TrojanServerService_ListUsersServer added in v0.4.3

type TrojanServerService_ListUsersServer interface {
	Send(*ListUserResponse) error
	grpc.ServerStream
}

type TrojanServerService_SetUsersClient added in v0.4.3

type TrojanServerService_SetUsersClient interface {
	Send(*SetUserRequest) error
	Recv() (*SetUserResponse, error)
	grpc.ClientStream
}

type TrojanServerService_SetUsersServer added in v0.4.3

type TrojanServerService_SetUsersServer interface {
	Send(*SetUserResponse) error
	Recv() (*SetUserRequest, error)
	grpc.ServerStream
}

type UnimplementedTrojanClientServiceServer added in v0.4.3

type UnimplementedTrojanClientServiceServer struct {
}

UnimplementedTrojanClientServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedTrojanClientServiceServer) GetTraffic added in v0.4.3

type UnimplementedTrojanServerServiceServer added in v0.4.3

type UnimplementedTrojanServerServiceServer struct {
}

UnimplementedTrojanServerServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedTrojanServerServiceServer) GetTraffic added in v0.4.3

func (*UnimplementedTrojanServerServiceServer) ListUsers added in v0.4.3

func (*UnimplementedTrojanServerServiceServer) SetUsers added in v0.4.3

type User added in v0.4.3

type User struct {
	Password             string   `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"`
	Hash                 string   `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*User) Descriptor added in v0.4.3

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

func (*User) GetHash added in v0.4.3

func (m *User) GetHash() string

func (*User) GetPassword added in v0.4.3

func (m *User) GetPassword() string

func (*User) ProtoMessage added in v0.4.3

func (*User) ProtoMessage()

func (*User) Reset added in v0.4.3

func (m *User) Reset()

func (*User) String added in v0.4.3

func (m *User) String() string

func (*User) XXX_DiscardUnknown added in v0.4.3

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal added in v0.4.3

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge added in v0.4.3

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size added in v0.4.3

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal added in v0.4.3

func (m *User) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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