@@ -60,10 +60,10 @@ var (
6060 )
6161)
6262
63- // Interceptor is a gRPC client interceptor that can handle LSAT authentication
64- // challenges with embedded payment requests. It uses a connection to lnd to
65- // automatically pay for an authentication token.
66- type Interceptor struct {
63+ // ClientInterceptor is a gRPC client interceptor that can handle LSAT
64+ // authentication challenges with embedded payment requests. It uses a
65+ // connection to lnd to automatically pay for an authentication token.
66+ type ClientInterceptor struct {
6767 lnd * lndclient.LndServices
6868 store Store
6969 callTimeout time.Duration
@@ -78,9 +78,9 @@ type Interceptor struct {
7878// indicated store already contains a usable token.
7979func NewInterceptor (lnd * lndclient.LndServices , store Store ,
8080 rpcCallTimeout time.Duration , maxCost ,
81- maxFee btcutil.Amount , allowInsecure bool ) * Interceptor {
81+ maxFee btcutil.Amount , allowInsecure bool ) * ClientInterceptor {
8282
83- return & Interceptor {
83+ return & ClientInterceptor {
8484 lnd : lnd ,
8585 store : store ,
8686 callTimeout : rpcCallTimeout ,
@@ -106,7 +106,7 @@ type interceptContext struct {
106106// indicating a payment challenge, a token is acquired and paid for
107107// automatically. The original request is then repeated back to the server, now
108108// with the new token attached.
109- func (i * Interceptor ) UnaryInterceptor (ctx context.Context , method string ,
109+ func (i * ClientInterceptor ) UnaryInterceptor (ctx context.Context , method string ,
110110 req , reply interface {}, cc * grpc.ClientConn , invoker grpc.UnaryInvoker ,
111111 opts ... grpc.CallOption ) error {
112112
@@ -153,7 +153,7 @@ func (i *Interceptor) UnaryInterceptor(ctx context.Context, method string,
153153// If there is an error returned and it is indicating a payment challenge, a
154154// token is acquired and paid for automatically. The original request is then
155155// repeated back to the server, now with the new token attached.
156- func (i * Interceptor ) StreamInterceptor (ctx context.Context ,
156+ func (i * ClientInterceptor ) StreamInterceptor (ctx context.Context ,
157157 desc * grpc.StreamDesc , cc * grpc.ClientConn , method string ,
158158 streamer grpc.Streamer , opts ... grpc.CallOption ) (grpc.ClientStream ,
159159 error ) {
@@ -195,7 +195,7 @@ func (i *Interceptor) StreamInterceptor(ctx context.Context,
195195// newInterceptContext creates the initial intercept context that can capture
196196// metadata from the server and sends the local token to the server if one
197197// already exists.
198- func (i * Interceptor ) newInterceptContext (ctx context.Context ,
198+ func (i * ClientInterceptor ) newInterceptContext (ctx context.Context ,
199199 opts []grpc.CallOption ) (* interceptContext , error ) {
200200
201201 iCtx := & interceptContext {
@@ -242,7 +242,7 @@ func (i *Interceptor) newInterceptContext(ctx context.Context,
242242
243243// handlePayment tries to obtain a valid token by either tracking the payment
244244// status of a pending token or paying for a new one.
245- func (i * Interceptor ) handlePayment (iCtx * interceptContext ) error {
245+ func (i * ClientInterceptor ) handlePayment (iCtx * interceptContext ) error {
246246 switch {
247247 // Resume/track a pending payment if it was interrupted for some reason.
248248 case iCtx .token != nil && iCtx .token .isPending ():
@@ -276,7 +276,7 @@ func (i *Interceptor) handlePayment(iCtx *interceptContext) error {
276276}
277277
278278// addLsatCredentials adds an LSAT token to the given intercept context.
279- func (i * Interceptor ) addLsatCredentials (iCtx * interceptContext ) error {
279+ func (i * ClientInterceptor ) addLsatCredentials (iCtx * interceptContext ) error {
280280 if iCtx .token == nil {
281281 return fmt .Errorf ("cannot add nil token to context" )
282282 }
@@ -294,7 +294,7 @@ func (i *Interceptor) addLsatCredentials(iCtx *interceptContext) error {
294294// payLsatToken reads the payment challenge from the response metadata and tries
295295// to pay the invoice encoded in them, returning a paid LSAT token if
296296// successful.
297- func (i * Interceptor ) payLsatToken (ctx context.Context , md * metadata.MD ) (
297+ func (i * ClientInterceptor ) payLsatToken (ctx context.Context , md * metadata.MD ) (
298298 * Token , error ) {
299299
300300 // First parse the authentication header that was stored in the
@@ -372,7 +372,7 @@ func (i *Interceptor) payLsatToken(ctx context.Context, md *metadata.MD) (
372372
373373// trackPayment tries to resume a pending payment by tracking its state and
374374// waiting for a conclusive result.
375- func (i * Interceptor ) trackPayment (ctx context.Context , token * Token ) error {
375+ func (i * ClientInterceptor ) trackPayment (ctx context.Context , token * Token ) error {
376376 // Lookup state of the payment.
377377 paymentStateCtx , cancel := context .WithCancel (ctx )
378378 defer cancel ()
0 commit comments