user agents

This commit is contained in:
Ben Wilson
2023-07-25 18:54:18 -04:00
parent e08de753b6
commit 3b583b3d67
5 changed files with 33 additions and 6 deletions
+1
View File
@@ -274,6 +274,7 @@ export class StratumV1Client extends EasyUnsubscribe {
sessionId: this.extraNonceAndSessionId,
address: this.clientAuthorization.address,
clientName: this.clientAuthorization.worker,
userAgent: this.clientSubscription.userAgent,
startTime: new Date(),
});
@@ -1,4 +1,5 @@
import { IsArray } from 'class-validator';
import { Expose, Transform } from 'class-transformer';
import { IsArray, IsString, MaxLength } from 'class-validator';
import { eRequestMethod } from '../enums/eRequestMethod';
import { StratumBaseMessage } from './StratumBaseMessage';
@@ -9,6 +10,14 @@ export class SubscriptionMessage extends StratumBaseMessage {
@IsArray()
params: string[];
@Expose()
@IsString()
@MaxLength(128)
@Transform(({ value, key, obj, type }) => {
return obj.params[0] == null ? 'default' : obj.params[0]
})
public userAgent: string;
constructor() {
super();
this.method = eRequestMethod.SUBSCRIBE;