File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,37 @@ import * as crypto from 'crypto';
88import { TPromise } from 'vs/base/common/winjs.base' ;
99import * as errors from 'vs/base/common/errors' ;
1010import * as uuid from 'vs/base/common/uuid' ;
11+ import { networkInterfaces } from 'os' ;
12+
13+
14+ const mac = new class {
15+
16+ private _value : string ;
17+
18+ get value ( ) : string {
19+ if ( this . _value === void 0 ) {
20+ this . _initValue ( ) ;
21+ }
22+ return this . _value ;
23+ }
24+
25+ private _initValue ( ) : void {
26+ this . _value = null ;
27+ const interfaces = networkInterfaces ( ) ;
28+ for ( let key in interfaces ) {
29+ for ( const i of interfaces [ key ] ) {
30+ if ( ! i . internal ) {
31+ this . _value = crypto . createHash ( 'sha256' ) . update ( i . mac , 'utf8' ) . digest ( 'hex' ) ;
32+ return ;
33+ }
34+ }
35+ }
36+ }
37+ } ;
38+
39+ export function _futureMachineIdExperiment ( ) : string {
40+ return mac . value ;
41+ }
1142
1243export function getMachineId ( ) : TPromise < string > {
1344 return new TPromise < string > ( resolve => {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
99import * as errors from 'vs/base/common/errors' ;
1010import * as uuid from 'vs/base/common/uuid' ;
1111import { IStorageService } from 'vs/platform/storage/common/storage' ;
12- import { getMachineId } from 'vs/base/node/id' ;
12+ import { getMachineId , _futureMachineIdExperiment } from 'vs/base/node/id' ;
1313import { resolveCommonProperties } from '../node/commonProperties' ;
1414
1515const SQM_KEY : string = '\\Software\\Microsoft\\SQMClient' ;
@@ -32,6 +32,7 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
3232 const promises : TPromise < any > [ ] = [ ] ;
3333 promises . push ( getOrCreateInstanceId ( storageService ) . then ( value => result [ 'common.instanceId' ] = value ) ) ;
3434 promises . push ( getOrCreateMachineId ( storageService ) . then ( value => result [ 'common.machineId' ] = value ) ) ;
35+ result [ 'common.machineIdExperiment' ] = _futureMachineIdExperiment ( ) ;
3536
3637 if ( process . platform === 'win32' ) {
3738 promises . push ( getSqmUserId ( storageService ) . then ( value => result [ 'common.sqm.userid' ] = value ) ) ;
You can’t perform that action at this time.
0 commit comments