2019-10-25 00:48:34 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var os = require('os');
|
2019-10-25 10:54:40 +00:00
|
|
|
var ver = require('../../package.json').version;
|
2019-10-25 00:48:34 +00:00
|
|
|
|
|
|
|
var UserAgent = module.exports;
|
2020-07-28 21:53:50 +00:00
|
|
|
UserAgent.get = function (me) {
|
2019-10-25 00:48:34 +00:00
|
|
|
// ACME clients MUST have an RFC7231-compliant User-Agent
|
|
|
|
// ex: Greenlock/v3 ACME.js/v3 node/v12.0.0 darwin/17.7.0 Darwin/x64
|
|
|
|
//
|
|
|
|
// See https://tools.ietf.org/html/rfc8555#section-6.1
|
|
|
|
// And https://tools.ietf.org/html/rfc7231#section-5.5.3
|
|
|
|
// And https://community.letsencrypt.org/t/user-agent-flag-explained/3843/2
|
|
|
|
|
|
|
|
var ua =
|
2019-10-25 00:53:08 +00:00
|
|
|
'ACME.js/' +
|
|
|
|
ver +
|
|
|
|
' ' +
|
2019-10-25 00:48:34 +00:00
|
|
|
process.release.name +
|
|
|
|
'/' +
|
|
|
|
process.version +
|
|
|
|
' ' +
|
|
|
|
os.platform() +
|
|
|
|
'/' +
|
|
|
|
os.release() +
|
|
|
|
' ' +
|
|
|
|
os.type() +
|
|
|
|
'/' +
|
|
|
|
process.arch;
|
|
|
|
|
|
|
|
var pkg = me.packageAgent;
|
|
|
|
if (pkg) {
|
|
|
|
ua = pkg + ' ' + ua;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ua;
|
|
|
|
};
|