diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bcb46ffe..cb4a33d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: # If you change this value, please change it in the following files as well: # /Dockerfile # /dev.Dockerfile - GO_VERSION: 1.22.3 + GO_VERSION: 1.22.6 jobs: ######################## diff --git a/.golangci.yml b/.golangci.yml index 7ff39caa..92132a96 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,7 +31,7 @@ linters-settings: - G402 # Look for bad TLS connection settings. - G306 # Poor file permissions used when writing to a new file. staticcheck: - go: "1.18" + go: "1.22.6" checks: ["-SA1019"] linters: diff --git a/Dockerfile b/Dockerfile index 037068a8..6be7121c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN apk add --no-cache --update alpine-sdk \ # If you change this value, please also update: # /dev.Dockerfile # /.github/workflows/main.yml -FROM golang:1.22.3-alpine as golangbuilder +FROM golang:1.22.6-alpine as golangbuilder # Instead of checking out from git again, we just copy the whole working # directory of the previous stage that includes the generated static assets. diff --git a/autopilotserverrpc/autopilotserver.pb.go b/autopilotserverrpc/autopilotserver.pb.go index dd9aece8..7e4797da 100644 --- a/autopilotserverrpc/autopilotserver.pb.go +++ b/autopilotserverrpc/autopilotserver.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: autopilotserver.proto package autopilotserverrpc @@ -1081,7 +1081,7 @@ func file_autopilotserver_proto_rawDescGZIP() []byte { } var file_autopilotserver_proto_msgTypes = make([]protoimpl.MessageInfo, 18) -var file_autopilotserver_proto_goTypes = []interface{}{ +var file_autopilotserver_proto_goTypes = []any{ (*TermsRequest)(nil), // 0: autopilotserverrpc.TermsRequest (*TermsResponse)(nil), // 1: autopilotserverrpc.TermsResponse (*Version)(nil), // 2: autopilotserverrpc.Version @@ -1135,7 +1135,7 @@ func file_autopilotserver_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_autopilotserver_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*TermsRequest); i { case 0: return &v.state @@ -1147,7 +1147,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*TermsResponse); i { case 0: return &v.state @@ -1159,7 +1159,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Version); i { case 0: return &v.state @@ -1171,7 +1171,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ListFeaturesRequest); i { case 0: return &v.state @@ -1183,7 +1183,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ActivateSessionRequest); i { case 0: return &v.state @@ -1195,7 +1195,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ActivateSessionResponse); i { case 0: return &v.state @@ -1207,7 +1207,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ListFeaturesResponse); i { case 0: return &v.state @@ -1219,7 +1219,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*Feature); i { case 0: return &v.state @@ -1231,7 +1231,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*Rule); i { case 0: return &v.state @@ -1243,7 +1243,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*Permissions); i { case 0: return &v.state @@ -1255,7 +1255,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*Operation); i { case 0: return &v.state @@ -1267,7 +1267,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*RegisterSessionRequest); i { case 0: return &v.state @@ -1279,7 +1279,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*RegisterSessionResponse); i { case 0: return &v.state @@ -1291,7 +1291,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*RevokeSessionRequest); i { case 0: return &v.state @@ -1303,7 +1303,7 @@ func file_autopilotserver_proto_init() { return nil } } - file_autopilotserver_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_autopilotserver_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*RevokeSessionResponse); i { case 0: return &v.state diff --git a/dev.Dockerfile b/dev.Dockerfile index c8d7e5ea..528b4f83 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -13,7 +13,7 @@ RUN cd /go/src/github.com/lightninglabs/lightning-terminal/app \ # If you change this value, please also update: # /Dockerfile # /.github/workflows/main.yml -FROM golang:1.22.3-alpine as golangbuilder +FROM golang:1.22.6-alpine as golangbuilder # Instead of checking out from git again, we just copy the whole working # directory of the previous stage that includes the generated static assets. diff --git a/litrpc/Dockerfile b/litrpc/Dockerfile index b2cf12b2..e60a23ae 100644 --- a/litrpc/Dockerfile +++ b/litrpc/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.19.4-buster +FROM golang:1.22.6-bookworm RUN apt-get update && apt-get install -y \ git \ - protobuf-compiler='3.6*' \ - clang-format='1:7.0*' + protobuf-compiler='3.21.12*' \ + clang-format='1:14.0*' # We don't want any default values for these variables to make sure they're # explicitly provided by parsing the go.mod file. Otherwise we might forget to diff --git a/litrpc/firewall.pb.go b/litrpc/firewall.pb.go index 3f9ce5fa..23a991ee 100644 --- a/litrpc/firewall.pb.go +++ b/litrpc/firewall.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: firewall.proto package litrpc @@ -691,7 +691,7 @@ func file_firewall_proto_rawDescGZIP() []byte { var file_firewall_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_firewall_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_firewall_proto_goTypes = []interface{}{ +var file_firewall_proto_goTypes = []any{ (ActionState)(0), // 0: litrpc.ActionState (*PrivacyMapConversionRequest)(nil), // 1: litrpc.PrivacyMapConversionRequest (*PrivacyMapConversionResponse)(nil), // 2: litrpc.PrivacyMapConversionResponse @@ -720,7 +720,7 @@ func file_firewall_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_firewall_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_firewall_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*PrivacyMapConversionRequest); i { case 0: return &v.state @@ -732,7 +732,7 @@ func file_firewall_proto_init() { return nil } } - file_firewall_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_firewall_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*PrivacyMapConversionResponse); i { case 0: return &v.state @@ -744,7 +744,7 @@ func file_firewall_proto_init() { return nil } } - file_firewall_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_firewall_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ListActionsRequest); i { case 0: return &v.state @@ -756,7 +756,7 @@ func file_firewall_proto_init() { return nil } } - file_firewall_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_firewall_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ListActionsResponse); i { case 0: return &v.state @@ -768,7 +768,7 @@ func file_firewall_proto_init() { return nil } } - file_firewall_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_firewall_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Action); i { case 0: return &v.state diff --git a/litrpc/firewall.pb.gw.go b/litrpc/firewall.pb.gw.go index 420e2a4e..a24a9465 100644 --- a/litrpc/firewall.pb.gw.go +++ b/litrpc/firewall.pb.gw.go @@ -35,11 +35,7 @@ func request_Firewall_ListActions_0(ctx context.Context, marshaler runtime.Marsh var protoReq ListActionsRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -52,11 +48,7 @@ func local_request_Firewall_ListActions_0(ctx context.Context, marshaler runtime var protoReq ListActionsRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -69,11 +61,7 @@ func request_Firewall_PrivacyMapConversion_0(ctx context.Context, marshaler runt var protoReq PrivacyMapConversionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -86,11 +74,7 @@ func local_request_Firewall_PrivacyMapConversion_0(ctx context.Context, marshale var protoReq PrivacyMapConversionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -103,6 +87,7 @@ func local_request_Firewall_PrivacyMapConversion_0(ctx context.Context, marshale // UnaryRPC :call FirewallServer 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 RegisterFirewallHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterFirewallHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FirewallServer) error { mux.Handle("POST", pattern_Firewall_ListActions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -161,21 +146,21 @@ func RegisterFirewallHandlerServer(ctx context.Context, mux *runtime.ServeMux, s // RegisterFirewallHandlerFromEndpoint is same as RegisterFirewallHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterFirewallHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -193,7 +178,7 @@ func RegisterFirewallHandler(ctx context.Context, mux *runtime.ServeMux, conn *g // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FirewallClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FirewallClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "FirewallClient" to call the correct interceptors. +// "FirewallClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterFirewallHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FirewallClient) error { mux.Handle("POST", pattern_Firewall_ListActions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/litrpc/lit-accounts.pb.go b/litrpc/lit-accounts.pb.go index 75314641..903a8473 100644 --- a/litrpc/lit-accounts.pb.go +++ b/litrpc/lit-accounts.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: lit-accounts.proto package litrpc @@ -807,7 +807,7 @@ func file_lit_accounts_proto_rawDescGZIP() []byte { } var file_lit_accounts_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_lit_accounts_proto_goTypes = []interface{}{ +var file_lit_accounts_proto_goTypes = []any{ (*CreateAccountRequest)(nil), // 0: litrpc.CreateAccountRequest (*CreateAccountResponse)(nil), // 1: litrpc.CreateAccountResponse (*Account)(nil), // 2: litrpc.Account @@ -848,7 +848,7 @@ func file_lit_accounts_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_lit_accounts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*CreateAccountRequest); i { case 0: return &v.state @@ -860,7 +860,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*CreateAccountResponse); i { case 0: return &v.state @@ -872,7 +872,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Account); i { case 0: return &v.state @@ -884,7 +884,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*AccountInvoice); i { case 0: return &v.state @@ -896,7 +896,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*AccountPayment); i { case 0: return &v.state @@ -908,7 +908,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*UpdateAccountRequest); i { case 0: return &v.state @@ -920,7 +920,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ListAccountsRequest); i { case 0: return &v.state @@ -932,7 +932,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ListAccountsResponse); i { case 0: return &v.state @@ -944,7 +944,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*AccountInfoRequest); i { case 0: return &v.state @@ -956,7 +956,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*RemoveAccountRequest); i { case 0: return &v.state @@ -968,7 +968,7 @@ func file_lit_accounts_proto_init() { return nil } } - file_lit_accounts_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_lit_accounts_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*RemoveAccountResponse); i { case 0: return &v.state diff --git a/litrpc/lit-accounts.pb.gw.go b/litrpc/lit-accounts.pb.gw.go index 4e095eea..2c867c3b 100644 --- a/litrpc/lit-accounts.pb.gw.go +++ b/litrpc/lit-accounts.pb.gw.go @@ -35,11 +35,7 @@ func request_Accounts_CreateAccount_0(ctx context.Context, marshaler runtime.Mar var protoReq CreateAccountRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -52,11 +48,7 @@ func local_request_Accounts_CreateAccount_0(ctx context.Context, marshaler runti var protoReq CreateAccountRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -69,11 +61,7 @@ func request_Accounts_UpdateAccount_0(ctx context.Context, marshaler runtime.Mar var protoReq UpdateAccountRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -103,11 +91,7 @@ func local_request_Accounts_UpdateAccount_0(ctx context.Context, marshaler runti var protoReq UpdateAccountRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -152,7 +136,7 @@ func local_request_Accounts_ListAccounts_0(ctx context.Context, marshaler runtim } var ( - filter_Accounts_RemoveAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}} + filter_Accounts_RemoveAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Accounts_RemoveAccount_0(ctx context.Context, marshaler runtime.Marshaler, client AccountsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -225,6 +209,7 @@ func local_request_Accounts_RemoveAccount_0(ctx context.Context, marshaler runti // UnaryRPC :call AccountsServer 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 RegisterAccountsHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAccountsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountsServer) error { mux.Handle("POST", pattern_Accounts_CreateAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -333,21 +318,21 @@ func RegisterAccountsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s // RegisterAccountsHandlerFromEndpoint is same as RegisterAccountsHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterAccountsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -365,7 +350,7 @@ func RegisterAccountsHandler(ctx context.Context, mux *runtime.ServeMux, conn *g // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountsClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountsClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AccountsClient" to call the correct interceptors. +// "AccountsClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAccountsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountsClient) error { mux.Handle("POST", pattern_Accounts_CreateAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/litrpc/lit-accounts.swagger.json b/litrpc/lit-accounts.swagger.json index 4889c71f..09a22616 100644 --- a/litrpc/lit-accounts.swagger.json +++ b/litrpc/lit-accounts.swagger.json @@ -139,23 +139,7 @@ "in": "body", "required": true, "schema": { - "type": "object", - "properties": { - "account_balance": { - "type": "string", - "format": "int64", - "description": "The new account balance to set. Set to -1 to not update the balance." - }, - "expiration_date": { - "type": "string", - "format": "int64", - "description": "The new account expiry to set. Set to -1 to not update the expiry. Set to 0\nto never expire." - }, - "label": { - "type": "string", - "description": "The label of the account to update. If an account has no label, then the ID\nmust be used instead." - } - } + "$ref": "#/definitions/AccountsUpdateAccountBody" } } ], @@ -166,6 +150,25 @@ } }, "definitions": { + "AccountsUpdateAccountBody": { + "type": "object", + "properties": { + "account_balance": { + "type": "string", + "format": "int64", + "description": "The new account balance to set. Set to -1 to not update the balance." + }, + "expiration_date": { + "type": "string", + "format": "int64", + "description": "The new account expiry to set. Set to -1 to not update the expiry. Set to 0\nto never expire." + }, + "label": { + "type": "string", + "description": "The label of the account to update. If an account has no label, then the ID\nmust be used instead." + } + } + }, "litrpcAccount": { "type": "object", "properties": { diff --git a/litrpc/lit-autopilot.pb.go b/litrpc/lit-autopilot.pb.go index 7da6f8cf..79678927 100644 --- a/litrpc/lit-autopilot.pb.go +++ b/litrpc/lit-autopilot.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: lit-autopilot.proto package litrpc @@ -924,7 +924,7 @@ func file_lit_autopilot_proto_rawDescGZIP() []byte { } var file_lit_autopilot_proto_msgTypes = make([]protoimpl.MessageInfo, 15) -var file_lit_autopilot_proto_goTypes = []interface{}{ +var file_lit_autopilot_proto_goTypes = []any{ (*AddAutopilotSessionRequest)(nil), // 0: litrpc.AddAutopilotSessionRequest (*FeatureConfig)(nil), // 1: litrpc.FeatureConfig (*ListAutopilotSessionsRequest)(nil), // 2: litrpc.ListAutopilotSessionsRequest @@ -983,7 +983,7 @@ func file_lit_autopilot_proto_init() { } file_lit_sessions_proto_init() if !protoimpl.UnsafeEnabled { - file_lit_autopilot_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*AddAutopilotSessionRequest); i { case 0: return &v.state @@ -995,7 +995,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*FeatureConfig); i { case 0: return &v.state @@ -1007,7 +1007,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ListAutopilotSessionsRequest); i { case 0: return &v.state @@ -1019,7 +1019,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*ListAutopilotSessionsResponse); i { case 0: return &v.state @@ -1031,7 +1031,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*AddAutopilotSessionResponse); i { case 0: return &v.state @@ -1043,7 +1043,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ListAutopilotFeaturesRequest); i { case 0: return &v.state @@ -1055,7 +1055,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ListAutopilotFeaturesResponse); i { case 0: return &v.state @@ -1067,7 +1067,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*RevokeAutopilotSessionRequest); i { case 0: return &v.state @@ -1079,7 +1079,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*RevokeAutopilotSessionResponse); i { case 0: return &v.state @@ -1091,7 +1091,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*Feature); i { case 0: return &v.state @@ -1103,7 +1103,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*RuleValues); i { case 0: return &v.state @@ -1115,7 +1115,7 @@ func file_lit_autopilot_proto_init() { return nil } } - file_lit_autopilot_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_lit_autopilot_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*Permissions); i { case 0: return &v.state diff --git a/litrpc/lit-autopilot.pb.gw.go b/litrpc/lit-autopilot.pb.gw.go index 20ce9efa..7929c85c 100644 --- a/litrpc/lit-autopilot.pb.gw.go +++ b/litrpc/lit-autopilot.pb.gw.go @@ -53,11 +53,7 @@ func request_Autopilot_AddAutopilotSession_0(ctx context.Context, marshaler runt var protoReq AddAutopilotSessionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -70,11 +66,7 @@ func local_request_Autopilot_AddAutopilotSession_0(ctx context.Context, marshale var protoReq AddAutopilotSessionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -157,6 +149,7 @@ func local_request_Autopilot_RevokeAutopilotSession_0(ctx context.Context, marsh // UnaryRPC :call AutopilotServer 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 RegisterAutopilotHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterAutopilotHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AutopilotServer) error { mux.Handle("GET", pattern_Autopilot_ListAutopilotFeatures_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -265,21 +258,21 @@ func RegisterAutopilotHandlerServer(ctx context.Context, mux *runtime.ServeMux, // RegisterAutopilotHandlerFromEndpoint is same as RegisterAutopilotHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterAutopilotHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -297,7 +290,7 @@ func RegisterAutopilotHandler(ctx context.Context, mux *runtime.ServeMux, conn * // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AutopilotClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AutopilotClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "AutopilotClient" to call the correct interceptors. +// "AutopilotClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterAutopilotHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AutopilotClient) error { mux.Handle("GET", pattern_Autopilot_ListAutopilotFeatures_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/litrpc/lit-sessions.pb.go b/litrpc/lit-sessions.pb.go index 2fa4db7a..f7739356 100644 --- a/litrpc/lit-sessions.pb.go +++ b/litrpc/lit-sessions.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: lit-sessions.proto package litrpc @@ -1938,7 +1938,7 @@ func file_lit_sessions_proto_rawDescGZIP() []byte { var file_lit_sessions_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_lit_sessions_proto_msgTypes = make([]protoimpl.MessageInfo, 24) -var file_lit_sessions_proto_goTypes = []interface{}{ +var file_lit_sessions_proto_goTypes = []any{ (SessionType)(0), // 0: litrpc.SessionType (SessionState)(0), // 1: litrpc.SessionState (*AddSessionRequest)(nil), // 2: litrpc.AddSessionRequest @@ -2010,7 +2010,7 @@ func file_lit_sessions_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_lit_sessions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*AddSessionRequest); i { case 0: return &v.state @@ -2022,7 +2022,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*MacaroonPermission); i { case 0: return &v.state @@ -2034,7 +2034,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*AddSessionResponse); i { case 0: return &v.state @@ -2046,7 +2046,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Session); i { case 0: return &v.state @@ -2058,7 +2058,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*MacaroonRecipe); i { case 0: return &v.state @@ -2070,7 +2070,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ListSessionsRequest); i { case 0: return &v.state @@ -2082,7 +2082,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*ListSessionsResponse); i { case 0: return &v.state @@ -2094,7 +2094,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*RevokeSessionRequest); i { case 0: return &v.state @@ -2106,7 +2106,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*RevokeSessionResponse); i { case 0: return &v.state @@ -2118,7 +2118,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*RulesMap); i { case 0: return &v.state @@ -2130,7 +2130,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[10].Exporter = func(v any, i int) any { switch v := v.(*RuleValue); i { case 0: return &v.state @@ -2142,7 +2142,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*RateLimit); i { case 0: return &v.state @@ -2154,7 +2154,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[12].Exporter = func(v any, i int) any { switch v := v.(*Rate); i { case 0: return &v.state @@ -2166,7 +2166,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*HistoryLimit); i { case 0: return &v.state @@ -2178,7 +2178,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[14].Exporter = func(v any, i int) any { switch v := v.(*ChannelPolicyBounds); i { case 0: return &v.state @@ -2190,7 +2190,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*OffChainBudget); i { case 0: return &v.state @@ -2202,7 +2202,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[16].Exporter = func(v any, i int) any { switch v := v.(*OnChainBudget); i { case 0: return &v.state @@ -2214,7 +2214,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*SendToSelf); i { case 0: return &v.state @@ -2226,7 +2226,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[18].Exporter = func(v any, i int) any { switch v := v.(*ChannelRestrict); i { case 0: return &v.state @@ -2238,7 +2238,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[19].Exporter = func(v any, i int) any { switch v := v.(*PeerRestrict); i { case 0: return &v.state @@ -2250,7 +2250,7 @@ func file_lit_sessions_proto_init() { return nil } } - file_lit_sessions_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_lit_sessions_proto_msgTypes[20].Exporter = func(v any, i int) any { switch v := v.(*ChannelConstraint); i { case 0: return &v.state @@ -2263,7 +2263,7 @@ func file_lit_sessions_proto_init() { } } } - file_lit_sessions_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_lit_sessions_proto_msgTypes[10].OneofWrappers = []any{ (*RuleValue_RateLimit)(nil), (*RuleValue_ChanPolicyBounds)(nil), (*RuleValue_HistoryLimit)(nil), diff --git a/litrpc/lit-sessions.pb.gw.go b/litrpc/lit-sessions.pb.gw.go index 3559339a..ef0fa5cc 100644 --- a/litrpc/lit-sessions.pb.gw.go +++ b/litrpc/lit-sessions.pb.gw.go @@ -35,11 +35,7 @@ func request_Sessions_AddSession_0(ctx context.Context, marshaler runtime.Marsha var protoReq AddSessionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -52,11 +48,7 @@ func local_request_Sessions_AddSession_0(ctx context.Context, marshaler runtime. var protoReq AddSessionRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -139,6 +131,7 @@ func local_request_Sessions_RevokeSession_0(ctx context.Context, marshaler runti // UnaryRPC :call SessionsServer 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 RegisterSessionsHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterSessionsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SessionsServer) error { mux.Handle("POST", pattern_Sessions_AddSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -222,21 +215,21 @@ func RegisterSessionsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s // RegisterSessionsHandlerFromEndpoint is same as RegisterSessionsHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterSessionsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -254,7 +247,7 @@ func RegisterSessionsHandler(ctx context.Context, mux *runtime.ServeMux, conn *g // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SessionsClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SessionsClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "SessionsClient" to call the correct interceptors. +// "SessionsClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterSessionsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SessionsClient) error { mux.Handle("POST", pattern_Sessions_AddSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/litrpc/lit-status.pb.go b/litrpc/lit-status.pb.go index 435c2710..5ceaccf3 100644 --- a/litrpc/lit-status.pb.go +++ b/litrpc/lit-status.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: lit-status.proto package litrpc @@ -236,7 +236,7 @@ func file_lit_status_proto_rawDescGZIP() []byte { } var file_lit_status_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_lit_status_proto_goTypes = []interface{}{ +var file_lit_status_proto_goTypes = []any{ (*SubServerStatusReq)(nil), // 0: litrpc.SubServerStatusReq (*SubServerStatusResp)(nil), // 1: litrpc.SubServerStatusResp (*SubServerStatus)(nil), // 2: litrpc.SubServerStatus @@ -260,7 +260,7 @@ func file_lit_status_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_lit_status_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_lit_status_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*SubServerStatusReq); i { case 0: return &v.state @@ -272,7 +272,7 @@ func file_lit_status_proto_init() { return nil } } - file_lit_status_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_lit_status_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*SubServerStatusResp); i { case 0: return &v.state @@ -284,7 +284,7 @@ func file_lit_status_proto_init() { return nil } } - file_lit_status_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_lit_status_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*SubServerStatus); i { case 0: return &v.state diff --git a/litrpc/lit-status.pb.gw.go b/litrpc/lit-status.pb.gw.go index 8edf5c1b..a95ec562 100644 --- a/litrpc/lit-status.pb.gw.go +++ b/litrpc/lit-status.pb.gw.go @@ -53,6 +53,7 @@ func local_request_Status_SubServerStatus_0(ctx context.Context, marshaler runti // UnaryRPC :call StatusServer 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 RegisterStatusHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterStatusHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StatusServer) error { mux.Handle("GET", pattern_Status_SubServerStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -86,21 +87,21 @@ func RegisterStatusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser // RegisterStatusHandlerFromEndpoint is same as RegisterStatusHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterStatusHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -118,7 +119,7 @@ func RegisterStatusHandler(ctx context.Context, mux *runtime.ServeMux, conn *grp // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StatusClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StatusClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "StatusClient" to call the correct interceptors. +// "StatusClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterStatusHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StatusClient) error { mux.Handle("GET", pattern_Status_SubServerStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/litrpc/proxy.pb.go b/litrpc/proxy.pb.go index d39203fd..56aa6589 100644 --- a/litrpc/proxy.pb.go +++ b/litrpc/proxy.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 -// protoc v3.6.1 +// protoc-gen-go v1.34.2 +// protoc v3.21.12 // source: proxy.proto package litrpc @@ -343,7 +343,7 @@ func file_proxy_proto_rawDescGZIP() []byte { } var file_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_proxy_proto_goTypes = []interface{}{ +var file_proxy_proto_goTypes = []any{ (*BakeSuperMacaroonRequest)(nil), // 0: litrpc.BakeSuperMacaroonRequest (*BakeSuperMacaroonResponse)(nil), // 1: litrpc.BakeSuperMacaroonResponse (*StopDaemonRequest)(nil), // 2: litrpc.StopDaemonRequest @@ -371,7 +371,7 @@ func file_proxy_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_proxy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*BakeSuperMacaroonRequest); i { case 0: return &v.state @@ -383,7 +383,7 @@ func file_proxy_proto_init() { return nil } } - file_proxy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*BakeSuperMacaroonResponse); i { case 0: return &v.state @@ -395,7 +395,7 @@ func file_proxy_proto_init() { return nil } } - file_proxy_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*StopDaemonRequest); i { case 0: return &v.state @@ -407,7 +407,7 @@ func file_proxy_proto_init() { return nil } } - file_proxy_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*StopDaemonResponse); i { case 0: return &v.state @@ -419,7 +419,7 @@ func file_proxy_proto_init() { return nil } } - file_proxy_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*GetInfoRequest); i { case 0: return &v.state @@ -431,7 +431,7 @@ func file_proxy_proto_init() { return nil } } - file_proxy_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_proxy_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*GetInfoResponse); i { case 0: return &v.state diff --git a/litrpc/proxy.pb.gw.go b/litrpc/proxy.pb.gw.go index c2e46dd9..7fecd1dc 100644 --- a/litrpc/proxy.pb.gw.go +++ b/litrpc/proxy.pb.gw.go @@ -53,11 +53,7 @@ func request_Proxy_StopDaemon_0(ctx context.Context, marshaler runtime.Marshaler var protoReq StopDaemonRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -70,11 +66,7 @@ func local_request_Proxy_StopDaemon_0(ctx context.Context, marshaler runtime.Mar var protoReq StopDaemonRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -87,11 +79,7 @@ func request_Proxy_BakeSuperMacaroon_0(ctx context.Context, marshaler runtime.Ma var protoReq BakeSuperMacaroonRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -104,11 +92,7 @@ func local_request_Proxy_BakeSuperMacaroon_0(ctx context.Context, marshaler runt var protoReq BakeSuperMacaroonRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -121,6 +105,7 @@ func local_request_Proxy_BakeSuperMacaroon_0(ctx context.Context, marshaler runt // UnaryRPC :call ProxyServer 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 RegisterProxyHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterProxyHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProxyServer) error { mux.Handle("GET", pattern_Proxy_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -204,21 +189,21 @@ func RegisterProxyHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv // RegisterProxyHandlerFromEndpoint is same as RegisterProxyHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterProxyHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -236,7 +221,7 @@ func RegisterProxyHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProxyClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProxyClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "ProxyClient" to call the correct interceptors. +// "ProxyClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterProxyHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProxyClient) error { mux.Handle("GET", pattern_Proxy_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/tools/Dockerfile b/tools/Dockerfile index e9282d22..10283a84 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3-bookworm +FROM golang:1.22.6-bookworm RUN apt-get update && apt-get install -y git ENV GOCACHE=/tmp/build/.cache