summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis R <mail@jannisr.de>2021-03-03 13:58:44 +0100
committerJannis R <mail@jannisr.de>2021-03-03 13:58:46 +0100
commit2bc162b388aa7b139a8807d4479030e4b168f2f7 (patch)
treea072276682db94bfb8fc30559123c0dc54282868
parentec8e8c67083404440d40067e5a40351521295397 (diff)
add linter, minor tweaks, 1.2.0
- add debug logging to connect() - readme: document verifyAlpnId() 📝
-rw-r--r--.eslintrc.json17
-rw-r--r--connect.js2
-rw-r--r--package.json6
-rw-r--r--readme.md6
4 files changed, 29 insertions, 2 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..1d44c69
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,17 @@
+{
+ "extends": "eslint:recommended",
+ "env": {
+ "commonjs": true,
+ "es6": true,
+ "node": true
+ },
+ "parserOptions": {
+ "ecmaVersion": 2018
+ },
+ "ignorePatterns": [
+ "node_modules"
+ ],
+ "rules": {
+ "no-unused-vars": "off"
+ }
+}
diff --git a/connect.js b/connect.js
index d508d35..f20533f 100644
--- a/connect.js
+++ b/connect.js
@@ -1,5 +1,6 @@
'use strict'
+const debug = require('debug')('gemini:connect')
const {connect: connectTls} = require('tls')
const {
DEFAULT_PORT,
@@ -12,6 +13,7 @@ const connectToGeminiServer = (opt, cb) => {
cb = opt
opt = {}
}
+ debug('connectToGeminiServer', opt)
const {
hostname,
port,
diff --git a/package.json b/package.json
index 4d9c0f4..5734c49 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@derhuerst/gemini",
"description": "Experimental Gemini server & client.",
- "version": "1.1.1",
+ "version": "1.2.0",
"main": "index.js",
"files": [
"index.js",
@@ -34,10 +34,12 @@
},
"devDependencies": {
"create-cert": "^1.0.6",
+ "eslint": "^7.21.0",
"get-stream": "^6.0.0"
},
"scripts": {
+ "lint": "eslint .",
"test": "node test.js",
- "prepublishOnly": "npm run test"
+ "prepublishOnly": "npm run lint && npm run test"
}
}
diff --git a/readme.md b/readme.md
index 3b3ff89..7739b06 100644
--- a/readme.md
+++ b/readme.md
@@ -114,6 +114,9 @@ createServer(opt = {}, onRequest)
cert: null, key: null, passphrase: null,
// additional options to be passed into `tls.createServer`
tlsOpt: {},
+ // verify the ALPN ID requested by the client
+ // see https://de.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation
+ verifyAlpnId: alpnId => alpnId ? alpnId === ALPN_ID : true,
}
```
@@ -139,6 +142,9 @@ request(pathOrUrl, opt = {}, cb)
connectTimeout: 60 * 1000, // 60s
// additional options to be passed into `tls.connect`
tlsOpt: {},
+ // verify the ALPN ID chosen by the server
+ // see https://de.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation
+ verifyAlpnId: alpnId => alpnId ? (alpnId === ALPN_ID) : true,
}
```