loooprpc: replace deprecated grpc.Dial with grpc.NewClient

- Update assets/client.go to use grpc.NewClient
- Update swap_server_client.go to use grpc.NewClient
- Replace grpc.WithInsecure() with insecure.NewCredentials()
This commit is contained in:
Slyghtning 2025-12-11 15:16:30 +01:00
parent a3db145ced
commit 175b7d601b
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
10 changed files with 1145 additions and 4309 deletions

View file

@ -306,7 +306,7 @@ func getClientConn(config *TapdConfig) (*grpc.ClientConn, error) {
} }
// Dial the gRPC server. // Dial the gRPC server.
conn, err := grpc.Dial(config.Host, opts...) conn, err := grpc.NewClient(config.Host, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }

3
go.mod
View file

@ -39,7 +39,7 @@ require (
go.etcd.io/bbolt v1.4.3 go.etcd.io/bbolt v1.4.3
golang.org/x/sync v0.18.0 golang.org/x/sync v0.18.0
google.golang.org/grpc v1.64.1 google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.36.5 google.golang.org/protobuf v1.36.11
gopkg.in/macaroon-bakery.v2 v2.3.0 gopkg.in/macaroon-bakery.v2 v2.3.0
gopkg.in/macaroon.v2 v2.1.0 gopkg.in/macaroon.v2 v2.1.0
modernc.org/sqlite v1.34.5 modernc.org/sqlite v1.34.5
@ -150,7 +150,6 @@ require (
github.com/prometheus/procfs v0.8.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect github.com/soheilhy/cmux v0.1.5 // indirect

View file

@ -1,4 +1,4 @@
FROM golang:1.21.9-bookworm FROM golang:1.24-bookworm
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \

File diff suppressed because it is too large Load diff

View file

@ -35,11 +35,7 @@ func request_SwapClient_LoopOut_0(ctx context.Context, marshaler runtime.Marshal
var protoReq LoopOutRequest var protoReq LoopOutRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -52,11 +48,7 @@ func local_request_SwapClient_LoopOut_0(ctx context.Context, marshaler runtime.M
var protoReq LoopOutRequest var protoReq LoopOutRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -69,11 +61,7 @@ func request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Marshale
var protoReq LoopInRequest var protoReq LoopInRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -86,11 +74,7 @@ func local_request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Ma
var protoReq LoopInRequest var protoReq LoopInRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -527,11 +511,7 @@ func request_SwapClient_SetLiquidityParams_0(ctx context.Context, marshaler runt
var protoReq SetLiquidityParamsRequest var protoReq SetLiquidityParamsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -544,11 +524,7 @@ func local_request_SwapClient_SetLiquidityParams_0(ctx context.Context, marshale
var protoReq SetLiquidityParamsRequest var protoReq SetLiquidityParamsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -597,11 +573,7 @@ func request_SwapClient_InstantOut_0(ctx context.Context, marshaler runtime.Mars
var protoReq InstantOutRequest var protoReq InstantOutRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -614,11 +586,7 @@ func local_request_SwapClient_InstantOut_0(ctx context.Context, marshaler runtim
var protoReq InstantOutRequest var protoReq InstantOutRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -631,11 +599,7 @@ func request_SwapClient_InstantOutQuote_0(ctx context.Context, marshaler runtime
var protoReq InstantOutQuoteRequest var protoReq InstantOutQuoteRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -648,11 +612,7 @@ func local_request_SwapClient_InstantOutQuote_0(ctx context.Context, marshaler r
var protoReq InstantOutQuoteRequest var protoReq InstantOutQuoteRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -683,11 +643,7 @@ func request_SwapClient_NewStaticAddress_0(ctx context.Context, marshaler runtim
var protoReq NewStaticAddressRequest var protoReq NewStaticAddressRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -700,11 +656,7 @@ func local_request_SwapClient_NewStaticAddress_0(ctx context.Context, marshaler
var protoReq NewStaticAddressRequest var protoReq NewStaticAddressRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -753,11 +705,7 @@ func request_SwapClient_WithdrawDeposits_0(ctx context.Context, marshaler runtim
var protoReq WithdrawDepositsRequest var protoReq WithdrawDepositsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -770,11 +718,7 @@ func local_request_SwapClient_WithdrawDeposits_0(ctx context.Context, marshaler
var protoReq WithdrawDepositsRequest var protoReq WithdrawDepositsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -877,11 +821,7 @@ func request_SwapClient_StaticAddressLoopIn_0(ctx context.Context, marshaler run
var protoReq StaticAddressLoopInRequest var protoReq StaticAddressLoopInRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -894,11 +834,7 @@ func local_request_SwapClient_StaticAddressLoopIn_0(ctx context.Context, marshal
var protoReq StaticAddressLoopInRequest var protoReq StaticAddressLoopInRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body) if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
@ -1619,21 +1555,21 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux,
// RegisterSwapClientHandlerFromEndpoint is same as RegisterSwapClientHandler but // RegisterSwapClientHandlerFromEndpoint is same as RegisterSwapClientHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done. // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSwapClientHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { func RegisterSwapClientHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...) conn, err := grpc.NewClient(endpoint, opts...)
if err != nil { if err != nil {
return err return err
} }
defer func() { defer func() {
if err != nil { if err != nil {
if cerr := conn.Close(); cerr != 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 return
} }
go func() { go func() {
<-ctx.Done() <-ctx.Done()
if cerr := conn.Close(); cerr != 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)
} }
}() }()
}() }()

View file

@ -1663,6 +1663,7 @@
"rules": { "rules": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcLiquidityRule" "$ref": "#/definitions/looprpcLiquidityRule"
}, },
"description": "A set of liquidity rules that describe the desired liquidity balance." "description": "A set of liquidity rules that describe the desired liquidity balance."
@ -1845,6 +1846,7 @@
"swaps": { "swaps": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcInstantOut" "$ref": "#/definitions/looprpcInstantOut"
}, },
"description": "The list of all currently known instant out swaps and their status." "description": "The list of all currently known instant out swaps and their status."
@ -1857,6 +1859,7 @@
"reservations": { "reservations": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcClientReservation" "$ref": "#/definitions/looprpcClientReservation"
}, },
"description": "The list of all currently known reservations and their status." "description": "The list of all currently known reservations and their status."
@ -1869,6 +1872,7 @@
"filtered_deposits": { "filtered_deposits": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcDeposit" "$ref": "#/definitions/looprpcDeposit"
}, },
"description": "A list of all deposits that match the filtered state." "description": "A list of all deposits that match the filtered state."
@ -1881,6 +1885,7 @@
"swaps": { "swaps": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcStaticAddressLoopInSwap" "$ref": "#/definitions/looprpcStaticAddressLoopInSwap"
}, },
"description": "A list of all swaps known static address loop-in swaps." "description": "A list of all swaps known static address loop-in swaps."
@ -1893,6 +1898,7 @@
"withdrawals": { "withdrawals": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcStaticAddressWithdrawal" "$ref": "#/definitions/looprpcStaticAddressWithdrawal"
}, },
"description": "A list of all static address withdrawals." "description": "A list of all static address withdrawals."
@ -1944,6 +1950,7 @@
"swaps": { "swaps": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcSwapStatus" "$ref": "#/definitions/looprpcSwapStatus"
}, },
"description": "The list of all currently known swaps and their status." "description": "The list of all currently known swaps and their status."
@ -1961,6 +1968,7 @@
"utxos": { "utxos": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcUtxo" "$ref": "#/definitions/looprpcUtxo"
}, },
"description": "A list of utxos behind the static address." "description": "A list of utxos behind the static address."
@ -2010,6 +2018,7 @@
"route_hints": { "route_hints": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcRouteHint" "$ref": "#/definitions/looprpcRouteHint"
}, },
"description": "Optional route hints to reach the destination through private channels." "description": "Optional route hints to reach the destination through private channels."
@ -2274,6 +2283,7 @@
"hop_hints": { "hop_hints": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcHopHint" "$ref": "#/definitions/looprpcHopHint"
}, },
"description": "A list of hop hints that when chained together can assist in reaching a\nspecific destination." "description": "A list of hop hints that when chained together can assist in reaching a\nspecific destination."
@ -2323,6 +2333,7 @@
"route_hints": { "route_hints": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcRouteHint" "$ref": "#/definitions/looprpcRouteHint"
}, },
"description": "Optional route hints to reach the destination through private channels." "description": "Optional route hints to reach the destination through private channels."
@ -2404,6 +2415,7 @@
"used_deposits": { "used_deposits": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcDeposit" "$ref": "#/definitions/looprpcDeposit"
}, },
"description": "The deposits that are used for this swap." "description": "The deposits that are used for this swap."
@ -2454,6 +2466,7 @@
"deposits": { "deposits": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcDeposit" "$ref": "#/definitions/looprpcDeposit"
}, },
"description": "The deposits that were used for this swap." "description": "The deposits that were used for this swap."
@ -2537,6 +2550,7 @@
"deposits": { "deposits": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcDeposit" "$ref": "#/definitions/looprpcDeposit"
}, },
"description": "The selected deposits that is withdrawn from." "description": "The selected deposits that is withdrawn from."
@ -2572,6 +2586,7 @@
"loop_out": { "loop_out": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcLoopOutRequest" "$ref": "#/definitions/looprpcLoopOutRequest"
}, },
"description": "The set of recommended loop outs." "description": "The set of recommended loop outs."
@ -2579,6 +2594,7 @@
"loop_in": { "loop_in": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcLoopInRequest" "$ref": "#/definitions/looprpcLoopInRequest"
}, },
"title": "The set of recommended loop in swaps" "title": "The set of recommended loop in swaps"
@ -2586,6 +2602,7 @@
"disqualified": { "disqualified": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcDisqualified" "$ref": "#/definitions/looprpcDisqualified"
}, },
"description": "Disqualified contains the set of channels that swaps are not recommended\nfor." "description": "Disqualified contains the set of channels that swaps are not recommended\nfor."
@ -2739,6 +2756,7 @@
"tokens": { "tokens": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcL402Token" "$ref": "#/definitions/looprpcL402Token"
}, },
"description": "List of all tokens the daemon knows of, including old/expired tokens." "description": "List of all tokens the daemon knows of, including old/expired tokens."
@ -2774,6 +2792,7 @@
"outpoints": { "outpoints": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/looprpcOutPoint" "$ref": "#/definitions/looprpcOutPoint"
}, },
"description": "The outpoints of the deposits to withdraw." "description": "The outpoints of the deposits to withdraw."
@ -2833,6 +2852,7 @@
"details": { "details": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object",
"$ref": "#/definitions/protobufAny" "$ref": "#/definitions/protobufAny"
} }
} }

View file

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.34.2 // protoc-gen-go v1.36.11
// protoc v3.21.12 // protoc v3.21.12
// source: debug.proto // source: debug.proto
@ -11,6 +11,7 @@ import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
unsafe "unsafe"
) )
const ( const (
@ -21,18 +22,16 @@ const (
) )
type ForceAutoLoopRequest struct { type ForceAutoLoopRequest struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
} }
func (x *ForceAutoLoopRequest) Reset() { func (x *ForceAutoLoopRequest) Reset() {
*x = ForceAutoLoopRequest{} *x = ForceAutoLoopRequest{}
if protoimpl.UnsafeEnabled { mi := &file_debug_proto_msgTypes[0]
mi := &file_debug_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *ForceAutoLoopRequest) String() string { func (x *ForceAutoLoopRequest) String() string {
@ -43,7 +42,7 @@ func (*ForceAutoLoopRequest) ProtoMessage() {}
func (x *ForceAutoLoopRequest) ProtoReflect() protoreflect.Message { func (x *ForceAutoLoopRequest) ProtoReflect() protoreflect.Message {
mi := &file_debug_proto_msgTypes[0] mi := &file_debug_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -59,18 +58,16 @@ func (*ForceAutoLoopRequest) Descriptor() ([]byte, []int) {
} }
type ForceAutoLoopResponse struct { type ForceAutoLoopResponse struct {
state protoimpl.MessageState state protoimpl.MessageState `protogen:"open.v1"`
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
} }
func (x *ForceAutoLoopResponse) Reset() { func (x *ForceAutoLoopResponse) Reset() {
*x = ForceAutoLoopResponse{} *x = ForceAutoLoopResponse{}
if protoimpl.UnsafeEnabled { mi := &file_debug_proto_msgTypes[1]
mi := &file_debug_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi)
ms.StoreMessageInfo(mi)
}
} }
func (x *ForceAutoLoopResponse) String() string { func (x *ForceAutoLoopResponse) String() string {
@ -81,7 +78,7 @@ func (*ForceAutoLoopResponse) ProtoMessage() {}
func (x *ForceAutoLoopResponse) ProtoReflect() protoreflect.Message { func (x *ForceAutoLoopResponse) ProtoReflect() protoreflect.Message {
mi := &file_debug_proto_msgTypes[1] mi := &file_debug_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -98,31 +95,22 @@ func (*ForceAutoLoopResponse) Descriptor() ([]byte, []int) {
var File_debug_proto protoreflect.FileDescriptor var File_debug_proto protoreflect.FileDescriptor
var file_debug_proto_rawDesc = []byte{ const file_debug_proto_rawDesc = "" +
0x0a, 0x0b, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, "\n" +
0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x22, 0x16, 0x0a, 0x14, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x41, "\vdebug.proto\x12\alooprpc\"\x16\n" +
0x75, 0x74, 0x6f, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, "\x14ForceAutoLoopRequest\"\x17\n" +
0x0a, 0x15, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x6f, 0x6f, 0x70, 0x52, "\x15ForceAutoLoopResponse2W\n" +
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x57, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, "\x05Debug\x12N\n" +
0x12, 0x4e, 0x0a, 0x0d, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x6f, 0x6f, "\rForceAutoLoop\x12\x1d.looprpc.ForceAutoLoopRequest\x1a\x1e.looprpc.ForceAutoLoopResponseB'Z%github.com/lightninglabs/loop/looprpcb\x06proto3"
0x70, 0x12, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x6f, 0x72, 0x63,
0x65, 0x41, 0x75, 0x74, 0x6f, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x6f, 0x72, 0x63, 0x65,
0x41, 0x75, 0x74, 0x6f, 0x4c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c,
0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f,
0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var ( var (
file_debug_proto_rawDescOnce sync.Once file_debug_proto_rawDescOnce sync.Once
file_debug_proto_rawDescData = file_debug_proto_rawDesc file_debug_proto_rawDescData []byte
) )
func file_debug_proto_rawDescGZIP() []byte { func file_debug_proto_rawDescGZIP() []byte {
file_debug_proto_rawDescOnce.Do(func() { file_debug_proto_rawDescOnce.Do(func() {
file_debug_proto_rawDescData = protoimpl.X.CompressGZIP(file_debug_proto_rawDescData) file_debug_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_debug_proto_rawDesc), len(file_debug_proto_rawDesc)))
}) })
return file_debug_proto_rawDescData return file_debug_proto_rawDescData
} }
@ -147,37 +135,11 @@ func file_debug_proto_init() {
if File_debug_proto != nil { if File_debug_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled {
file_debug_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*ForceAutoLoopRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_debug_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*ForceAutoLoopResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_debug_proto_rawDesc, RawDescriptor: unsafe.Slice(unsafe.StringData(file_debug_proto_rawDesc), len(file_debug_proto_rawDesc)),
NumEnums: 0, NumEnums: 0,
NumMessages: 2, NumMessages: 2,
NumExtensions: 0, NumExtensions: 0,
@ -188,7 +150,6 @@ func file_debug_proto_init() {
MessageInfos: file_debug_proto_msgTypes, MessageInfos: file_debug_proto_msgTypes,
}.Build() }.Build()
File_debug_proto = out.File File_debug_proto = out.File
file_debug_proto_rawDesc = nil
file_debug_proto_goTypes = nil file_debug_proto_goTypes = nil
file_debug_proto_depIdxs = nil file_debug_proto_depIdxs = nil
} }

View file

@ -3,10 +3,10 @@ module github.com/lightninglabs/loop/looprpc
go 1.24.9 go 1.24.9
require ( require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
github.com/lightninglabs/loop/swapserverrpc v1.0.13 github.com/lightninglabs/loop/swapserverrpc v1.0.14
google.golang.org/grpc v1.64.1 google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2 google.golang.org/protobuf v1.36.11
gopkg.in/macaroon-bakery.v2 v2.3.0 gopkg.in/macaroon-bakery.v2 v2.3.0
) )
@ -14,11 +14,11 @@ require (
github.com/go-macaroon-bakery/macaroonpb v1.0.0 // indirect github.com/go-macaroon-bakery/macaroonpb v1.0.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect github.com/golang/protobuf v1.5.4 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
golang.org/x/crypto v0.45.0 // indirect golang.org/x/crypto v0.45.0 // indirect
golang.org/x/net v0.47.0 // indirect golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.38.0 // indirect golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.31.0 // indirect golang.org/x/text v0.31.0 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
gopkg.in/errgo.v1 v1.0.1 // indirect gopkg.in/errgo.v1 v1.0.1 // indirect

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
@ -896,7 +897,7 @@ func rpcRouteCancel(details *outCancelDetails) (
// getSwapServerConn returns a connection to the swap server. A non-empty // getSwapServerConn returns a connection to the swap server. A non-empty
// proxyAddr indicates that a SOCKS proxy found at the address should be used to // proxyAddr indicates that a SOCKS proxy found at the address should be used to
// establish the connection. // establish the connection.
func getSwapServerConn(address, proxyAddress string, insecure bool, func getSwapServerConn(address, proxyAddress string, skipCertCheck bool,
tlsPath string, interceptor *l402.ClientInterceptor) (*grpc.ClientConn, tlsPath string, interceptor *l402.ClientInterceptor) (*grpc.ClientConn,
error) { error) {
@ -914,8 +915,9 @@ func getSwapServerConn(address, proxyAddress string, insecure bool,
// using a self-signed certificate or with a certificate signed by a // using a self-signed certificate or with a certificate signed by a
// public CA. // public CA.
switch { switch {
case insecure: case skipCertCheck:
opts = append(opts, grpc.WithInsecure()) creds := insecure.NewCredentials()
opts = append(opts, grpc.WithTransportCredentials(creds))
case tlsPath != "": case tlsPath != "":
// Load the specified TLS certificate and build // Load the specified TLS certificate and build
@ -945,7 +947,7 @@ func getSwapServerConn(address, proxyAddress string, insecure bool,
opts = append(opts, grpc.WithContextDialer(torDialer)) opts = append(opts, grpc.WithContextDialer(torDialer))
} }
conn, err := grpc.Dial(address, opts...) conn, err := grpc.NewClient(address, opts...)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to connect to RPC server: %v", return nil, fmt.Errorf("unable to connect to RPC server: %v",
err) err)