Skip to content
Snippets Groups Projects
Commit 08c4394f authored by Nicolas Fernandes's avatar Nicolas Fernandes
Browse files

merge'

parents ef73fd84 477647ef
No related branches found
No related tags found
No related merge requests found
Showing
with 7618 additions and 22 deletions
[-] CMP Le code du serveur compile correctement avec Maven
[-] DOC Le code du serveur est documenté (Readme.md, Javadoc)
[x] CMP Le code du serveur s'exécute correctement avec NPM
[x] DOC Le code du serveur est documenté (Readme.md, JsDoc)
[-] TST Le code du serveur est proporement testé (tests unitaires sous JUnit)
[-] COO Le code du serveur est conçu en suivant les principes de conception objet
[-] EXE Le code du serveur s'exécute
[-] CON Je peux me connecter au serveur avec un client FTP
[-] BADU Le serveur rejette ma connection si mon utilisateur est inconnu
[-] BADP Le serveur rejette ma connection si mon mot de passe est incorrect
[x] COO Le code du serveur est conçu en suivant les principes de conception objet
[x] EXE Le code du serveur s'exécute
[x] CON Je peux me connecter au serveur avec un client FTP
[x] BADU Le serveur rejette ma connection si mon utilisateur est inconnu
[x] BADP Le serveur rejette ma connection si mon mot de passe est incorrect
[x] LST Je peux lister le contenu d'un répertoire distant
[x] CWD Je peux entrer dans un répertoire distant
[x] CDUP Je peux quitter un répertoire distant
[x] ROOT Je ne peux pas descendre dans la hiérarchie au delà du répertoire racine de l'utilisateur
[x] GETT Je peux télécharger un fichier texte
[x] GETB Je peux télécharger un fichier binaire (image)
[-] GETR Je peux télécharger un répertoire complet
[x] GETR Je peux télécharger un répertoire complet
[-] PUTT Je peux mettre en ligne un fichier texte
[-] PUTB Je peux mettre en ligne un fichier binaire (image)
[-] PUTR Je peux mettre en ligne un répertoire complet
[-] RENF Je peux renommer un fichier distant
[x] RENF Je peux renommer un fichier distant
[x] MKD Je peux créer un répertoire distant
[-] REND Je peux renommer un répertoire distant
[x] REND Je peux renommer un répertoire distant
[x] RMD Je peux supprimer un répertoire distant
[-] CLOS Je peux couper proprement la connection (sans crasher le serveur)
[-] PORT Je peux configurer le port du serveur FTP
[-] HOME Je peux configurer le répertoire racine du serveur FTP
[x] CLOS Je peux couper proprement la connection (sans crasher le serveur)
[x] PORT Je peux configurer le port du serveur FTP
[x] HOME Je peux configurer le répertoire racine du serveur FTP
[-] ACPA Le serveur supporte le mode ACTIF et PASSIF
[-] THRE Le serveur supporte la connexion de plusieurs clients simultanés
\ No newline at end of file
[x] THRE Le serveur supporte la connexion de plusieurs clients simultanés
\ No newline at end of file
import { Socket } from 'net'
/**
* Active connection mode
* @class
*/
export default class Active extends ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
super(connection)
}
/**
* Prepares new connection
* @param {object} options {host, port}
*/
prepareConnection = ({ host, port }) => {
this.dataSocket = new Socket();
this.dataSocket.connect({ host, port }, () => {
console.log("connected to active mode")
})
});
}
}
\ No newline at end of file
/**
* Represents connection mode
* @class
*/
export default class ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
this.connection = connection
}
......
......@@ -2,12 +2,23 @@ import ConnectorMode from './ConnectorMode'
import { createServer } from 'net';
import { write } from '../utils/responseUtils.js'
/**
* Represents passive connection mode
* @class
*/
export default class Passive extends ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
super(connection)
this.prepareConnection()
}
/**
* Prepares for server connection
*/
prepareConnection = async () => {
const serverData = createServer(socket => this.setupDataSocket(socket));
serverData.listen(0, () => {
......@@ -18,6 +29,10 @@ export default class Passive extends ConnectorMode {
});
}
/**
* Setting up data socket
* @param {Socket} socket
*/
setupDataSocket = (socket) => {
console.log('client connected to data pipe')
this.dataSocket = socket;
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: connectorType/Active.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: connectorType/Active.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import { Socket } from 'net'
/**
* Active connection mode
* @class
*/
export default class Active extends ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
super(connection)
}
/**
* Prepares new connection
* @param {object} options {host, port}
*/
prepareConnection = ({ host, port }) => {
this.dataSocket = new Socket();
this.dataSocket.connect({ host, port }, () => {
console.log("connected to active mode")
});
}
waitConnection = () => { }
}</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#cdup">cdup</a></li><li><a href="global.html#cwd">cwd</a></li><li><a href="global.html#initConnection">initConnection</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkd">mkd</a></li><li><a href="global.html#pwd">pwd</a></li><li><a href="global.html#retr">retr</a></li><li><a href="global.html#rmd">rmd</a></li><li><a href="global.html#rnfr">rnfr</a></li><li><a href="global.html#rnto">rnto</a></li><li><a href="global.html#stor">stor</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sat Mar 06 2021 17:47:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: connectorType/ConnectorMode.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: connectorType/ConnectorMode.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* Represents connection mode
* @class
*/
export default class ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
this.connection = connection
}
prepareConnection = () => { }
waitConnection = () => { }
destroyDataSocket = () => {
if (this.dataSocket) this.dataSocket.destroy()
}
}</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#cdup">cdup</a></li><li><a href="global.html#cwd">cwd</a></li><li><a href="global.html#initConnection">initConnection</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkd">mkd</a></li><li><a href="global.html#pwd">pwd</a></li><li><a href="global.html#retr">retr</a></li><li><a href="global.html#rmd">rmd</a></li><li><a href="global.html#rnfr">rnfr</a></li><li><a href="global.html#rnto">rnto</a></li><li><a href="global.html#stor">stor</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sat Mar 06 2021 17:47:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: connectorType/Passive.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: connectorType/Passive.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import ConnectorMode from './ConnectorMode'
import { createServer } from 'net';
import { write } from '../utils/responseUtils.js'
/**
* Represents passive connection mode
* @class
*/
export default class Passive extends ConnectorMode {
/**
* @param {ConnectionFTP} connection
*/
constructor(connection) {
super(connection)
this.prepareConnection()
}
/**
* Prepares for server connection
*/
prepareConnection = async () => {
const serverData = createServer(socket => this.setupDataSocket(socket));
serverData.listen(0, () => {
const portData = serverData.address().port;
this.pasv = `227 Entering passive mode (127,0,0,1,${Math.floor(portData / 256).toString()},${Math.floor(portData % 256).toString()}).`
console.log('Server data created on port' + portData)
write(this.connection.commandSocket, this.pasv);
});
}
/**
* Setting up data socket
* @param {Socket} socket
*/
setupDataSocket = (socket) => {
console.log('client connected to data pipe')
this.dataSocket = socket;
}
}</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports.html">exports</a></li></ul><h3>Global</h3><ul><li><a href="global.html#cdup">cdup</a></li><li><a href="global.html#cwd">cwd</a></li><li><a href="global.html#initConnection">initConnection</a></li><li><a href="global.html#list">list</a></li><li><a href="global.html#mkd">mkd</a></li><li><a href="global.html#pwd">pwd</a></li><li><a href="global.html#retr">retr</a></li><li><a href="global.html#rmd">rmd</a></li><li><a href="global.html#rnfr">rnfr</a></li><li><a href="global.html#rnto">rnto</a></li><li><a href="global.html#stor">stor</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sat Mar 06 2021 17:47:04 GMT+0100 (Central European Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
File added
This diff is collapsed.
File added
File added
This diff is collapsed.
File added
File added
This diff is collapsed.
File added
File added
This diff is collapsed.
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment