Skip to content

Commit 7d6bb8c

Browse files
committed
More build improvements. Added more options for what addresses to use for server sockets and mdns.
1 parent 1020123 commit 7d6bb8c

File tree

62 files changed

+893
-441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+893
-441
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ I started this to help me understand the TNFS protocol, as I intend to implement
1111
* `tnfscp` or *TNFS Copy*. A `cp` like tool for simple copies of files and directories from the command line and scripts.
1212
* `tnfstp` or *TNFS Transfer Program*. An `ftp` like tool, but with advanced command line completion, highlighting and more.
1313
* `tnfs-fuse`. Mount TNFS resources to your file system and access them easily in any program. Makes use of [libfuse](https://github.com/libfuse/libfuse).
14-
* `tnfsd`. An alternative server implementation with extra features such as mDNS support, UPnP support, and enhanced file systemm and security features, particularly when used with *TNFS Java* client tools.
15-
* `tnfs-web`. An alternative web front-end based on [elFinder](https://github.com/Studio-42/elFinder).
14+
* `tnfsjd`. An alternative server implementation with extra features such as mDNS support, UPnP support, and enhanced file systemm and security features, particularly when used with *TNFS Java* client tools.
15+
* `tnfsjd-web`. An alternative web front-end based on [elFinder](https://github.com/Studio-42/elFinder).
1616
* All server tools have a `Dockerfile` to build your own docker containers.
1717

1818
See [Releases](releases) for downloads.

cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tnfsfuse - Mount TNFS resource to local file system</description>
4444
<groupId>org.apache.maven.plugins</groupId>
4545
<artifactId>maven-compiler-plugin</artifactId>
4646
<configuration>
47-
<release>22</release>
47+
<release>24</release>
4848
<annotationProcessorPaths>
4949
<path>
5050
<groupId>info.picocli</groupId>

client/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,4 @@
4343
<artifactId>slf4j-simple</artifactId>
4444
</dependency>
4545
</dependencies>
46-
<build>
47-
<plugins>
48-
<plugin>
49-
<groupId>org.apache.maven.plugins</groupId>
50-
<artifactId>maven-compiler-plugin</artifactId>
51-
<configuration>
52-
<release>17</release>
53-
<testRelease>17</testRelease>
54-
</configuration>
55-
</plugin>
56-
</plugins>
57-
</build>
5846
</project>

client/src/main/java/uk/co/bithatch/tnfs/client/DefaultTNFSMount.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package uk.co.bithatch.tnfs.client;
2222

2323
import java.io.IOException;
24+
import java.net.SocketTimeoutException;
2425

2526
import uk.co.bithatch.tnfs.lib.Command;
2627
import uk.co.bithatch.tnfs.lib.Message;
@@ -55,8 +56,13 @@ public TNFSMount build() throws IOException {
5556

5657
private DefaultTNFSMount(Builder bldr) throws IOException {
5758
super(bldr);
58-
var rep = client.send(Command.MOUNT, Message.of(Command.MOUNT, new Command.Mount(bldr.path, username, password)));
59-
sessionId = rep.mesage().connectionId();
59+
try {
60+
var rep = client.send(Command.MOUNT, Message.of(Command.MOUNT, new Command.Mount(bldr.path, username, password)));
61+
sessionId = rep.mesage().connectionId();
62+
}
63+
catch(SocketTimeoutException ste) {
64+
throw new IOException("No TNFS service responded to request.");
65+
}
6066
}
6167

6268
@Override

client/src/main/java/uk/co/bithatch/tnfs/client/TNFSClient.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.FileNotFoundException;
2626
import java.io.IOException;
2727
import java.net.InetSocketAddress;
28+
import java.net.SocketTimeoutException;
2829
import java.net.StandardSocketOptions;
2930
import java.nio.BufferUnderflowException;
3031
import java.nio.channels.DatagramChannel;
@@ -239,12 +240,17 @@ Message write(Message pkt) throws IOException, EOFException {
239240
dchannel.receive(buf);
240241

241242
buf.flip();
242-
var msg = Message.decode(buf);
243-
if(msg.seq() == pkt.seq()) {
244-
return msg;
243+
if(buf.hasRemaining()) {
244+
var msg = Message.decode(buf);
245+
if(msg.seq() == pkt.seq()) {
246+
return msg;
247+
}
248+
else {
249+
throw new IllegalStateException(String.format("Out of sequence (newer) response, lost a message. Expected %d, got %d", pkt.seq(), msg.seq()));
250+
}
245251
}
246252
else {
247-
throw new IllegalStateException(String.format("Out of sequence (newer) response, lost a message. Expected %d, got %d", pkt.seq(), msg.seq()));
253+
throw new SocketTimeoutException();
248254
}
249255
}
250256
else if(channel instanceof SocketChannel tchannel) {

client/src/main/java/uk/co/bithatch/tnfs/client/TNFSMount.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
import uk.co.bithatch.tnfs.lib.ModeFlag;
3232
import uk.co.bithatch.tnfs.lib.OpenFlag;
3333
import uk.co.bithatch.tnfs.lib.TNFSDirectory;
34-
import uk.co.bithatch.tnfs.lib.TNFSFileSystem;
34+
import uk.co.bithatch.tnfs.lib.TNFSFileAccess;
3535

36-
public interface TNFSMount extends TNFSFileSystem {
36+
public interface TNFSMount extends TNFSFileAccess {
3737

3838
/**
3939
* List all the names of entries in the root of this mount. This is a convenience method

daemon/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ RUN mvn -f $HOME/pom.xml clean package -Dbuild.native.daemon=true
3434
# Package stage
3535
#
3636
FROM debian:stable-slim
37-
COPY --from=build /usr/app/daemon/target/tnfsd /app/tnfsd
37+
COPY --from=build /usr/app/daemon/target/tnfsjd /app/tnfsjd
3838
COPY --from=build /usr/app/daemon/target/tnfs-user /app/tnfs-user
39-
COPY --from=build /usr/app/daemon/src/main/docker/configuration /etc/tnfsd
39+
COPY --from=build /usr/app/daemon/src/main/docker/configuration /etc/tnfsjd
40+
COPY --from=build /usr/app/daemon/src/main/docker/public-files /public-files
4041
EXPOSE 16384
4142
EXPOSE 16384/udp
42-
VOLUME /data
43-
VOLUME /etc/tnfsd
44-
ENTRYPOINT /app/tnfsd -L INFO
43+
VOLUME /public-files
44+
VOLUME /configuration
45+
ENTRYPOINT /app/tnfsjd -L INFO -C /etc/tnfsjd -O /configuration

daemon/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# tnfs-java-daemon
22

3-
A ready-to-go TNFS server, `tnfsd`.
3+
A ready-to-go TNFS server, `tnfsjd`.
44

55
* UDP and TCP connections.
66
* [TNFS Java Extensions](../extensions).
@@ -17,15 +17,15 @@ There are a few different ways to run the daemon. See `--help` option for more i
1717
The are self-contained, pre-built binaries for a few platforms. If yours is one supported, just download the executables and run.
1818

1919
```
20-
/path/to/tnfsd --help
20+
/path/to/tnfsjd --help
2121
```
2222

2323
### Download Cross Platform Jars
2424

2525
If you have a JDK installed, you can just download the `.jar` builds and run them.
2626

2727
```
28-
java -jar /path/to/tnfsd.jar --help
28+
java -jar /path/to/tnfsjd.jar --help
2929
```
3030

3131
### Run From Source
@@ -39,7 +39,7 @@ You probably only want to do this if you are working on tnfs-java itself. You wi
3939
The run the application by choosing the appropriate profile and supplying the `args` property.
4040

4141
```
42-
mvn exec:run -P tnfsd -Dargs="--help"
42+
mvn exec:run -P tnfsjd -Dargs="--help"
4343
```
4444

4545
### Docker
@@ -78,12 +78,12 @@ By default, the daemon and it's tools expect configuration files to be in certai
7878

7979
| OS | User | Location |
8080
| --- | --- | --- |
81-
| Linux | root / server | /etc/tnfsd |
82-
| Linux | standard users | $HOME/.configuration/tnfsd |
83-
| Windows | administrator / service | C:\\Program Files\\Common Files\\tnfsd |
84-
| Windows | standard users | %HOME%/AppData/Roaming\\tnfsd |
85-
| Other | administrator / service | /etc/tnfsd |
86-
| Other | standard users | $HOME/.tnfsd |
81+
| Linux | root / server | /etc/tnfsjd |
82+
| Linux | standard users | $HOME/.configuration/tnfsjd |
83+
| Windows | administrator / service | C:\\Program Files\\Common Files\\tnfsjd |
84+
| Windows | standard users | %HOME%/AppData/Roaming\\tnfsjd |
85+
| Other | administrator / service | /etc/tnfsjd |
86+
| Other | standard users | $HOME/.tnfsjd |
8787

8888
If you wish to use configuration from any other directory, use the `-C` (or `--configuration`) argument with the daemon or any tools.
8989

daemon/pom.xml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<groupId>uk.co.bithatch</groupId>
2929
<artifactId>tnfs-java</artifactId>
3030
<version>0.9.0-SNAPSHOT</version>
31-
<relativePath>../</relativePath>
31+
<relativePath>../</relativePath>
3232
</parent>
3333
<artifactId>tnfs-java-daemon</artifactId>
3434
<name>Java TNFS - Daemon</name>
@@ -43,6 +43,11 @@
4343
<artifactId>tnfs-java-server-extensions</artifactId>
4444
<version>${project.version}</version>
4545
</dependency>
46+
<dependency>
47+
<groupId>${project.groupId}</groupId>
48+
<artifactId>tnfs-java-daemonlib</artifactId>
49+
<version>${project.version}</version>
50+
</dependency>
4651
<dependency>
4752
<groupId>org.slf4j</groupId>
4853
<artifactId>slf4j-simple</artifactId>
@@ -51,10 +56,6 @@
5156
<groupId>info.picocli</groupId>
5257
<artifactId>picocli</artifactId>
5358
</dependency>
54-
<dependency>
55-
<groupId>org.jmdns</groupId>
56-
<artifactId>jmdns</artifactId>
57-
</dependency>
5859
<dependency>
5960
<groupId>com.sshtools</groupId>
6061
<artifactId>porter</artifactId>
@@ -70,6 +71,8 @@
7071
<groupId>org.apache.maven.plugins</groupId>
7172
<artifactId>maven-compiler-plugin</artifactId>
7273
<configuration>
74+
<release>17</release>
75+
<testRelease>17</testRelease>
7376
<annotationProcessorPaths>
7477
<path>
7578
<groupId>info.picocli</groupId>
@@ -86,13 +89,13 @@
8689
<inherited>false</inherited>
8790
<executions>
8891
<execution>
89-
<id>make-assembly-tnfsd</id>
92+
<id>make-assembly-tnfsjd</id>
9093
<phase>package</phase>
9194
<goals>
9295
<goal>single</goal>
9396
</goals>
9497
<configuration>
95-
<finalName>tnfsd</finalName>
98+
<finalName>tnfsjd</finalName>
9699
<archive>
97100
<manifest>
98101
<mainClass>uk.co.bithatch.tnfs.daemon.TNFSDaemon</mainClass>
@@ -168,15 +171,15 @@
168171
<artifactId>native-maven-plugin</artifactId>
169172
<executions>
170173
<execution>
171-
<id>tnfsd-native-image</id>
174+
<id>tnfsjd-native-image</id>
172175
<goals>
173176
<goal>build</goal>
174177
</goals>
175178
<phase>package</phase>
176179
<configuration>
177180
<mainClass>uk.co.bithatch.tnfs.daemon.TNFSDaemon</mainClass>
178181
<skip>false</skip>
179-
<imageName>tnfsd</imageName>
182+
<imageName>tnfsjd</imageName>
180183
<buildArgs>
181184
<buildArg>--install-exit-handlers</buildArg>
182185
<buildArg>-march=compatibility</buildArg>
@@ -207,10 +210,10 @@
207210

208211
<!-- tnfscp -->
209212
<profile>
210-
<id>tnfsd</id>
213+
<id>tnfsjd</id>
211214
<activation>
212215
<property>
213-
<name>tnfsd</name>
216+
<name>tnfsjd</name>
214217
</property>
215218
</activation>
216219
<build>

daemon/src/main/docker/configuration/authentication.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
;----------------------------------------
55
;[authentication]
66

7-
; Server Key - The servers key.
8-
; key =
7+
; Server Key - The servers key.
8+
; key =

0 commit comments

Comments
 (0)