Enable remote debug for java function (#222)
This commit is contained in:
Родитель
2df74f7df4
Коммит
d8fd84a524
|
@ -37,6 +37,7 @@ to get started with the Azure Functions extension.
|
|||
* View, create, delete, start, stop, and restart Azure Function Apps
|
||||
* JSON Intellisense for `function.json`, `host.json`, and `proxies.json`
|
||||
* Stream logs from your remote Function Apps
|
||||
* Debug Java Function App on Azure (experimental)
|
||||
|
||||
### Create New Project
|
||||
|
||||
|
|
31
package.json
31
package.json
|
@ -43,6 +43,7 @@
|
|||
"onCommand:azureFunctions.deleteFunction",
|
||||
"onCommand:azureFunctions.deploy",
|
||||
"onCommand:azureFunctions.configureDeploymentSource",
|
||||
"onCommand:azureFunctions.debugFunctionAppOnAzure",
|
||||
"onCommand:azureFunctions.appSettings.add",
|
||||
"onCommand:azureFunctions.appSettings.edit",
|
||||
"onCommand:azureFunctions.appSettings.rename",
|
||||
|
@ -133,6 +134,11 @@
|
|||
"title": "%azFunc.configureDeploymentSource%",
|
||||
"category": "Azure Functions"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.debugFunctionAppOnAzure",
|
||||
"title": "%azFunc.debugFunctionAppOnAzure%",
|
||||
"category": "Azure Functions"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.copyFunctionUrl",
|
||||
"title": "%azFunc.copyFunctionUrl%",
|
||||
|
@ -257,6 +263,11 @@
|
|||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp",
|
||||
"group": "2@3"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.deleteFunctionApp",
|
||||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp",
|
||||
"group": "2@4"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.configureDeploymentSource",
|
||||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp",
|
||||
|
@ -273,14 +284,14 @@
|
|||
"group": "4@2"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.deleteFunctionApp",
|
||||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp",
|
||||
"group": "2@4"
|
||||
"command": "azureFunctions.debugFunctionAppOnAzure",
|
||||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp && config.azureFunctions.enableRemoteDebugging == true",
|
||||
"group": "5@1"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.refresh",
|
||||
"when": "view == azureFunctionsExplorer && viewItem == azFuncFunctionApp",
|
||||
"group": "5@1"
|
||||
"group": "6@1"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.refresh",
|
||||
|
@ -352,6 +363,10 @@
|
|||
{
|
||||
"command": "azureFunctions.pickProcess",
|
||||
"when": "never"
|
||||
},
|
||||
{
|
||||
"command": "azureFunctions.debugFunctionAppOnAzure",
|
||||
"when": "config.azureFunctions.enableRemoteDebugging == true"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -442,6 +457,11 @@
|
|||
"type": "boolean",
|
||||
"description": "%azFunc.show64BitWarningDescription%",
|
||||
"default": true
|
||||
},
|
||||
"azureFunctions.enableRemoteDebugging": {
|
||||
"type": "boolean",
|
||||
"description": "%azFunc.enableRemoteDebugging%",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -461,6 +481,7 @@
|
|||
"@types/request": "2.0.7",
|
||||
"@types/request-promise": "4.1.38",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/websocket": "^0.0.37",
|
||||
"@types/xml2js": "^0.4.2",
|
||||
"@types/xregexp": "^3.0.29",
|
||||
"gulp": "^3.9.1",
|
||||
|
@ -482,6 +503,7 @@
|
|||
"ms-rest": "^2.2.2",
|
||||
"ms-rest-azure": "^2.3.1",
|
||||
"opn": "^5.2.0",
|
||||
"portfinder": "^1.0.13",
|
||||
"ps-node": "^0.1.6",
|
||||
"request-promise": "^4.2.2",
|
||||
"semver": "^5.5.0",
|
||||
|
@ -490,6 +512,7 @@
|
|||
"vscode-azurekudu": "~0.1.4",
|
||||
"vscode-extension-telemetry": "^0.0.10",
|
||||
"vscode-nls": "^2.0.2",
|
||||
"websocket": "^1.0.25",
|
||||
"xml2js": "^0.4.19",
|
||||
"xregexp": "^4.0.0"
|
||||
},
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
"azFunc.projectLanguageDescription": "The default language to use when performing operations in the Azure Functions extension (e.g. \"Create New Function\"). \"F#\", and \"JavaScript\" are currently the only languages approved for production use with runtime \"~1\". \"JavaScript\", \"C#\", and \"Java\" are the only languages that currently support debugging in VS Code.",
|
||||
"azFunc.deploy": "Deploy to Function App",
|
||||
"azFunc.configureDeploymentSource": "Configure Deployment Source",
|
||||
"azFunc.debugFunctionAppOnAzure": "Attach Debugger",
|
||||
"azFunc.appSettings.add": "Add new setting...",
|
||||
"azFunc.appSettings.edit": "Edit setting...",
|
||||
"azFunc.appSettings.rename": "Rename setting...",
|
||||
|
@ -29,5 +30,6 @@
|
|||
"azFunc.showCoreToolsWarningDescription": "Show a warning if your installed version of Azure Functions Core Tools is out-of-date.",
|
||||
"azFunc.show64BitWarningDescription": "Show a warning to install a 64-bit version of the Azure Functions Core Tools when you create a .NET Framework project.",
|
||||
"azFunc.startStreamingLogs": "Start Streaming Logs",
|
||||
"azFunc.stopStreamingLogs": "Stop Streaming Logs"
|
||||
"azFunc.stopStreamingLogs": "Stop Streaming Logs",
|
||||
"azFunc.enableRemoteDebugging": "Enable remote debugging, an experimental feature that only supports Java-based Functions Apps."
|
||||
}
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { User } from 'azure-arm-website/lib/models';
|
||||
import * as EventEmitter from 'events';
|
||||
import { createServer, Server, Socket } from 'net';
|
||||
import { OutputChannel } from 'vscode';
|
||||
import { SiteWrapper } from 'vscode-azureappservice';
|
||||
import KuduClient from 'vscode-azurekudu';
|
||||
import * as websocket from 'websocket';
|
||||
|
||||
export class DebugProxy extends EventEmitter {
|
||||
private _server: Server | undefined;
|
||||
private _wsclient: websocket.client | undefined;
|
||||
private _wsconnection: websocket.connection | undefined;
|
||||
private _siteWrapper: SiteWrapper;
|
||||
private _kuduClient: KuduClient;
|
||||
private _port: number;
|
||||
private _publishCredential: User;
|
||||
private _keepAlive: boolean;
|
||||
private _outputChannel: OutputChannel;
|
||||
|
||||
constructor(outputChannel: OutputChannel, siteWrapper: SiteWrapper, port: number, publishCredential: User, kuduClient: KuduClient) {
|
||||
super();
|
||||
this._siteWrapper = siteWrapper;
|
||||
this._port = port;
|
||||
this._publishCredential = publishCredential;
|
||||
this._kuduClient = kuduClient;
|
||||
this._keepAlive = true;
|
||||
this._outputChannel = outputChannel;
|
||||
this._server = createServer();
|
||||
}
|
||||
|
||||
public async startProxy(): Promise<void> {
|
||||
if (!this._server) {
|
||||
this.emit('error', new Error('Proxy server is not started.'));
|
||||
} else {
|
||||
// wake up the function app before connecting to it.
|
||||
await this.keepAlive();
|
||||
|
||||
this._server.on('connection', (socket: Socket) => {
|
||||
if (this._wsclient) {
|
||||
this._outputChannel.appendLine(`[Proxy Server] The server is already connected to "${this._wsclient.url.hostname}". Rejected connection to "${socket.remoteAddress}:${socket.remotePort}"`);
|
||||
this.emit('error', new Error(`[Proxy Server] The server is already connected to "${this._wsclient.url.hostname}". Rejected connection to "${socket.remoteAddress}:${socket.remotePort}"`));
|
||||
socket.destroy();
|
||||
} else {
|
||||
this._outputChannel.appendLine(`[Proxy Server] client connected ${socket.remoteAddress}:${socket.remotePort}`);
|
||||
socket.pause();
|
||||
|
||||
this._wsclient = new websocket.client();
|
||||
|
||||
this._wsclient.on('connect', (connection: websocket.connection) => {
|
||||
this._outputChannel.appendLine('[WebSocket] client connected');
|
||||
this._wsconnection = connection;
|
||||
|
||||
connection.on('close', () => {
|
||||
this._outputChannel.appendLine('[WebSocket] client closed');
|
||||
this.dispose();
|
||||
socket.destroy();
|
||||
this.emit('end');
|
||||
});
|
||||
|
||||
connection.on('error', (err: Error) => {
|
||||
this._outputChannel.appendLine(`[WebSocket] ${err}`);
|
||||
this.dispose();
|
||||
socket.destroy();
|
||||
this.emit('error', err);
|
||||
});
|
||||
|
||||
connection.on('message', (data: websocket.IMessage) => {
|
||||
socket.write(data.binaryData);
|
||||
});
|
||||
socket.resume();
|
||||
});
|
||||
|
||||
this._wsclient.on('connectFailed', (err: Error) => {
|
||||
this._outputChannel.appendLine(`[WebSocket] ${err}`);
|
||||
this.dispose();
|
||||
socket.destroy();
|
||||
this.emit('error', err);
|
||||
});
|
||||
|
||||
this._wsclient.connect(
|
||||
`wss://${this._siteWrapper.kuduUrl.replace(/https?:\/\//, '')}/DebugSiteExtension/JavaDebugSiteExtension.ashx`,
|
||||
undefined,
|
||||
undefined,
|
||||
{ 'Cache-Control': 'no-cache', Pragma: 'no-cache' },
|
||||
{ auth: `${this._publishCredential.publishingUserName}:${this._publishCredential.publishingPassword}` }
|
||||
);
|
||||
|
||||
socket.on('data', (data: Buffer) => {
|
||||
if (this._wsconnection) {
|
||||
this._wsconnection.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('end', () => {
|
||||
this._outputChannel.appendLine(`[Proxy Server] client disconnected ${socket.remoteAddress}:${socket.remotePort}`);
|
||||
this.dispose();
|
||||
this.emit('end');
|
||||
});
|
||||
|
||||
socket.on('error', (err: Error) => {
|
||||
this._outputChannel.appendLine(`[Proxy Server] ${err}`);
|
||||
this.dispose();
|
||||
socket.destroy();
|
||||
this.emit('error', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this._server.on('listening', () => {
|
||||
this._outputChannel.appendLine('[Proxy Server] start listening');
|
||||
this.emit('start');
|
||||
});
|
||||
|
||||
this._server.listen({
|
||||
host: 'localhost',
|
||||
port: this._port,
|
||||
backlog: 1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._wsconnection) {
|
||||
this._wsconnection.close();
|
||||
this._wsconnection = undefined;
|
||||
}
|
||||
if (this._wsclient) {
|
||||
this._wsclient.abort();
|
||||
this._wsclient = undefined;
|
||||
}
|
||||
if (this._server) {
|
||||
this._server.close();
|
||||
this._server = undefined;
|
||||
}
|
||||
this._keepAlive = false;
|
||||
}
|
||||
|
||||
//keep querying the function app state, otherwise the connection will lose.
|
||||
private async keepAlive(): Promise<void> {
|
||||
if (this._keepAlive) {
|
||||
try {
|
||||
await this.pingFunctionApp();
|
||||
setTimeout(this.keepAlive, 60 * 1000 /* 60 seconds */);
|
||||
} catch (err) {
|
||||
this._outputChannel.appendLine(`[Proxy Server] ${err}`);
|
||||
setTimeout(this.keepAlive, 5 * 1000 /* 5 seconds */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async pingFunctionApp(): Promise<void> {
|
||||
await this._siteWrapper.pingFunctionApp(this._kuduClient);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// tslint:disable-next-line:no-require-imports
|
||||
import WebSiteManagementClient = require('azure-arm-website');
|
||||
import { SiteConfigResource, StringDictionary, User } from 'azure-arm-website/lib/models';
|
||||
import * as opn from "opn";
|
||||
import * as portfinder from 'portfinder';
|
||||
import * as vscode from 'vscode';
|
||||
import { SiteWrapper } from 'vscode-azureappservice';
|
||||
import { AzureTreeDataProvider, IAzureNode, UserCancelledError } from 'vscode-azureextensionui';
|
||||
import KuduClient from 'vscode-azurekudu';
|
||||
import { DebugProxy } from '../DebugProxy';
|
||||
import { DialogResponses } from '../DialogResponses';
|
||||
import { localize } from '../localize';
|
||||
import { FunctionAppTreeItem } from '../tree/FunctionAppTreeItem';
|
||||
import { nodeUtils } from '../utils/nodeUtils';
|
||||
|
||||
const HTTP_PLATFORM_DEBUG_PORT: string = '8898';
|
||||
const JAVA_OPTS: string = `-Djava.net.preferIPv4Stack=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:${HTTP_PLATFORM_DEBUG_PORT}`;
|
||||
|
||||
export async function remoteDebugFunctionApp(outputChannel: vscode.OutputChannel, tree: AzureTreeDataProvider, node?: IAzureNode<FunctionAppTreeItem>): Promise<void> {
|
||||
if (!node) {
|
||||
node = <IAzureNode<FunctionAppTreeItem>>await tree.showNodePicker(FunctionAppTreeItem.contextValue);
|
||||
}
|
||||
const client: WebSiteManagementClient = nodeUtils.getWebSiteClient(node);
|
||||
const siteWrapper: SiteWrapper = node.treeItem.siteWrapper;
|
||||
const portNumber: number = await portfinder.getPortPromise();
|
||||
const publishCredential: User = await siteWrapper.getWebAppPublishCredential(client);
|
||||
const kuduClient: KuduClient = await siteWrapper.getKuduClient(client);
|
||||
const debugProxy: DebugProxy = new DebugProxy(outputChannel, siteWrapper, portNumber, publishCredential, kuduClient);
|
||||
|
||||
debugProxy.on('error', (err: Error) => {
|
||||
debugProxy.dispose();
|
||||
throw err;
|
||||
});
|
||||
|
||||
await vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, async (p: vscode.Progress<{}>) => {
|
||||
// tslint:disable-next-line:no-any
|
||||
return new Promise(async (resolve: () => void, reject: (e: any) => void): Promise<void> => {
|
||||
try {
|
||||
const siteConfig: SiteConfigResource = await siteWrapper.getSiteConfig(client);
|
||||
const appSettings: StringDictionary = await client.webApps.listApplicationSettings(siteWrapper.resourceGroup, siteWrapper.appName);
|
||||
if (needUpdateSiteConfig(siteConfig) || (appSettings.properties && needUpdateAppSettings(appSettings.properties))) {
|
||||
const confirmMsg: string = localize('azFunc.confirmRemoteDebug', 'The configurations of the selected app will be changed before debugging. Would you like to continue?');
|
||||
const result: vscode.MessageItem | undefined = await vscode.window.showWarningMessage(confirmMsg, DialogResponses.yes, DialogResponses.seeMoreInfo, DialogResponses.cancel);
|
||||
if (result === DialogResponses.cancel) {
|
||||
throw new UserCancelledError();
|
||||
} else if (result === DialogResponses.seeMoreInfo) {
|
||||
// tslint:disable-next-line:no-unsafe-any
|
||||
opn('https://aka.ms/azfunc-remotedebug');
|
||||
return;
|
||||
} else {
|
||||
await updateSiteConfig(outputChannel, siteWrapper, client, p, siteConfig);
|
||||
await updateAppSettings(outputChannel, siteWrapper, client, p, appSettings);
|
||||
}
|
||||
}
|
||||
|
||||
p.report({ message: 'starting debug proxy...' });
|
||||
outputChannel.appendLine('starting debug proxy...');
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
debugProxy.startProxy();
|
||||
debugProxy.on('start', resolve);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const sessionId: string = Date.now().toString();
|
||||
|
||||
await vscode.debug.startDebugging(undefined, {
|
||||
name: sessionId,
|
||||
type: 'java',
|
||||
request: 'attach',
|
||||
hostName: 'localhost',
|
||||
port: portNumber
|
||||
});
|
||||
|
||||
const terminateDebugListener: vscode.Disposable = vscode.debug.onDidTerminateDebugSession((event: vscode.DebugSession) => {
|
||||
if (event.name === sessionId) {
|
||||
if (debugProxy !== undefined) {
|
||||
debugProxy.dispose();
|
||||
}
|
||||
terminateDebugListener.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async function updateSiteConfig(outputChannel: vscode.OutputChannel, siteWrapper: SiteWrapper, client: WebSiteManagementClient, p: vscode.Progress<{}>, siteConfig: SiteConfigResource): Promise<void> {
|
||||
p.report({ message: 'Fetching site configuration...' });
|
||||
outputChannel.appendLine('Fetching site configuration...');
|
||||
if (needUpdateSiteConfig(siteConfig)) {
|
||||
siteConfig.use32BitWorkerProcess = false;
|
||||
siteConfig.webSocketsEnabled = true;
|
||||
p.report({ message: 'Updating site configuration to enable remote debugging...' });
|
||||
outputChannel.appendLine('Updating site configuration to enable remote debugging...');
|
||||
await siteWrapper.updateConfiguration(client, siteConfig);
|
||||
p.report({ message: 'Updating site configuration done...' });
|
||||
outputChannel.appendLine('Updating site configuration done...');
|
||||
}
|
||||
}
|
||||
|
||||
async function updateAppSettings(outputChannel: vscode.OutputChannel, siteWrapper: SiteWrapper, client: WebSiteManagementClient, p: vscode.Progress<{}>, appSettings: StringDictionary): Promise<void> {
|
||||
p.report({ message: 'Fetching application settings...' });
|
||||
outputChannel.appendLine('Fetching application settings...');
|
||||
if (appSettings.properties && needUpdateAppSettings(appSettings.properties)) {
|
||||
appSettings.properties.JAVA_OPTS = JAVA_OPTS;
|
||||
appSettings.properties.HTTP_PLATFORM_DEBUG_PORT = HTTP_PLATFORM_DEBUG_PORT;
|
||||
p.report({ message: 'Updating application settings to enable remote debugging...' });
|
||||
outputChannel.appendLine('Updating application settings to enable remote debugging...');
|
||||
await client.webApps.updateApplicationSettings(siteWrapper.resourceGroup, siteWrapper.appName, appSettings);
|
||||
p.report({ message: 'Updating application settings done...' });
|
||||
outputChannel.appendLine('Updating application settings done...');
|
||||
}
|
||||
}
|
||||
|
||||
function needUpdateSiteConfig(siteConfig: SiteConfigResource): boolean {
|
||||
return siteConfig.use32BitWorkerProcess || !siteConfig.webSocketsEnabled;
|
||||
}
|
||||
|
||||
function needUpdateAppSettings(properties: {}): boolean | undefined {
|
||||
// tslint:disable-next-line:no-string-literal
|
||||
return properties['JAVA_OPTS'] !== JAVA_OPTS || properties['HTTP_PLATFORM_DEBUG_PORT'] !== HTTP_PLATFORM_DEBUG_PORT;
|
||||
}
|
|
@ -24,6 +24,7 @@ import { startStreamingLogs } from './commands/logstream/startStreamingLogs';
|
|||
import { stopStreamingLogs } from './commands/logstream/stopStreamingLogs';
|
||||
import { openInPortal } from './commands/openInPortal';
|
||||
import { pickFuncProcess } from './commands/pickFuncProcess';
|
||||
import { remoteDebugFunctionApp } from './commands/remoteDebugFunctionApp';
|
||||
import { renameAppSetting } from './commands/renameAppSetting';
|
||||
import { restartFunctionApp } from './commands/restartFunctionApp';
|
||||
import { startFunctionApp } from './commands/startFunctionApp';
|
||||
|
@ -93,6 +94,7 @@ export function activate(context: vscode.ExtensionContext): void {
|
|||
actionHandler.registerCommand('azureFunctions.appSettings.delete', async (node: IAzureNode<AppSettingTreeItem>) => await deleteNode(tree, AppSettingTreeItem.contextValue, node));
|
||||
actionHandler.registerCommand('azureFunctions.installDotnetTemplates', async () => await dotnetUtils.installDotnetTemplates(outputChannel));
|
||||
actionHandler.registerCommand('azureFunctions.uninstallDotnetTemplates', async () => await dotnetUtils.uninstallDotnetTemplates(outputChannel));
|
||||
actionHandler.registerCommand('azureFunctions.debugFunctionAppOnAzure', async (node?: IAzureNode<FunctionAppTreeItem>) => await remoteDebugFunctionApp(outputChannel, tree, node));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ are grateful to these developers for their contribution to open source.
|
|||
6. xregexp (https://github.com/slevithan/xregexp)
|
||||
7. opn (https://github.com/sindresorhus/opn)
|
||||
8. semver (https://github.com/npm/node-semver)
|
||||
9. portfinder (https://github.com/indexzero/node-portfinder)
|
||||
10. websocket (https://github.com/theturtle32/WebSocket-Node)
|
||||
|
||||
fs-extra NOTICES BEGIN HERE
|
||||
=============================
|
||||
|
@ -193,3 +195,217 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
END OF semver NOTICES AND INFORMATION
|
||||
==================================
|
||||
|
||||
node-portfinder NOTICES BEGIN HERE
|
||||
=============================
|
||||
|
||||
node-portfinder
|
||||
|
||||
Copyright (c) 2012 Charlie Robbins
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
END OF node-portfinder NOTICES AND INFORMATION
|
||||
==================================
|
||||
|
||||
websocket NOTICES BEGIN HERE
|
||||
=============================
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
END OF websocket NOTICES AND INFORMATION
|
||||
==================================
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче