It's an alternative implementation of original ps3netsrv which needed to install games using WebMAN/IrisMAN over network (without copying files to console).
I made it because original code is way hard to read and hard to build for some platforms. And for fun and education (understanding and implementation custom network protocols, generating/serving iso image on-the-fly) of course.
This project written in Go because it's (cross-)compilation is much easier than C/C++ and resulting binaries will run without any external library on target system.
- Write protection. Enabled by default, use flag
--allow-writeor corresponding parameter. - TCP data exchange timeouts / auto-close of idle connections: configured by
--read-timeoutparameter. - Compressed images - save your disk space without filesystem-level compression.
- Built-in client: see
ps3netsrv-go client --help
- Simple file transfer / directory listing
- File streaming including game images in
PS3ISO - PSX images streaming
- Client addresses whitelist, capping amount of connections
- Virtual ISO: games in directory format (residing in
GAMES). Note: #28 - 3k3y/Redump images: if iso path is
<root>/PS3ISO/game.isothan dedicated key expected at<root>/PS3ISO/game.dkeyor at<root>/REDKEY/game.dkey
- Multipart files
*.666xx - Subdir scanning if requested by WebMAN #29
- PS2 Games, more tests/debugging needed #31
ps3netsrv-go supports compressed images to help save disk space. Currently only MAME CHD format is supported.
CHD is a format for space-efficient lossless compression that preserves ability to randomly access data without full decompression of whole file. Originally developed as part of MAME but today used in many emulators: ScePSX, Duckstation, PCSX2 and others. Space-efficiency is achieved by combining multiple comression algorithms to different data types (audio, data, ...) inside a raw disk image.
Powered by:
- libchdr - a C-library used to read and decompress CHD files
- purego - a loader that allows to call functions in a dynamically-loaded shared libraries without CGO.
- zig cc - C toolchain with fantastic cross-compilation abilities.
libchdr is required to be installed on the system. See Installation for more details how to do this.
Just put your .chd images into necessary directory under server root: PSXISO, PS2ISO or even PS3ISO.
In case of successful libchdr loading you will see a following log message on server start:
Mar 23 00:00:00.000 INF libchdr loaded, enabling chd support
PS3 will see such images as .chd.iso - server intentionally adds .iso extension to help console properly detecting a file type.
Use chdman tool maintained by MAME to compress your existing images.
- PS1 (PSX) images: tested and working ✅ (kudos to @turbosagat for assistance)
- PS2 images: tested and not working ❌ (to be investigated in #31)
- PS3 images: untested ❔ (technically should work because uses same codebase as PS1 images)
puregodoes not work on some platforms supported by Go (i.e.aixandppc64). However, they're pretty exotic nowdays and it's highly unlikely to seeps3netsrv-gorunning on them.libchdrdoes not supportAVHuffcompression codec: rtissera/libchdr#69. However it's used mainly for laserdiscs so it's very unlikely to meet it in videogame images.- Mixed CD/non-CD codecs (
cdlzandlzma) and mixed CD modes (MODE1,MODE1/RAW, etc. in image metadata) are not supported. It's possible to create such image only by specifying-coption inchdmanand probably such images are not supported by other emulators as well.
This project shipped in a multiple ways for convenient installation:
- Docker images:
docker pull ghcr.io/xakep666/ps3netsrv-go.amd64andarm64images are available. - Linux packages: deb, rpm and archlinux. See Releases. If your distro is based on other package manager you may want to use a simple binary and a systemd unit.
- Archived binaries are also available in Releases.
This libarary is required to enable CHD images support. It's included in a following release types:
- Docker: present in a container image, should work out of the box
- Release archive: contains compiled version of library except Windows/arm64 build.
libchdr is not included in Linux packages but declared as a dependancy. Most distros contain it in their repos.
If necessary, getting it compiled on Linux is pretty straightforward if you're familiar with CMake.
Server supports configuration via environment variables and command line flags.
Environment variables names can be found in output of ps3netsrv-go server --help command.
I.e. in line:
--root="." Root directory with games ($PS3NETSRV_ROOT).
PS3NETSRV_ROOT is environment variable name.
Also server supports configuration via config file. Example:
[server]
root = /home/user/games
client-whitelist = 192.168.1.0/24
max-clients = 10
allow-write = trueConfiguration keys names are the same as command line flags names without -- prefix.
Config file discovered in following order:
--configflag orPS3NETSRV_CONFIG_FILEenvironment variableconfig.inifile in current directory<user config directory>/ps3netsrv-go/config.ini, where<user config directory>is OS-specific directory for user configuration files:%APPDATA%on Windows$XDG_CONFIG_HOMEor~/.configon Linux~/Library/Application Supporton macOS
Download necessary archive from Releases, unpack it and run
$ ps3netsrv-go serverfrom your working directory to serve it.
Or specify custom root directory in --root flag of server subcommand:
$ ps3netsrv-go server --root=/home/user/gamesTo get help run:
$ ps3netsrv-go --helpTo run "debug" server (for pprof, etc.) specify --debug-server-listen-addr flag.
Recommended way to serve your directory is:
$ docker run \
-u $(id -u):$(id -g) \
-v <data directory>:/srv/ps3data \
-p 38008:38008 \
ghcr.io/xakep666/ps3netsrv-goBut note that listen address displayed in logs is not an address you can connect to because it's container internal address.
In-container persistent volume is also available in /srv/ps3data.
Deb, rpm and archlinux packages are shipped with systemd unit. Run
$ systemctl daemon-reload
$ systemctl enable ps3netsrv-goto enable automatic startup.
Config file location is /etc/ps3netsrv-go/config.ini. Data location is /srv/ps3data. Service is running under separate user ps3netsrv.
Due to usage of purego all Linux executables in releases are dynamically linked ones.
By default they're linked to run with glibc because it's most popular and widespread libc.
However, some distros like Alpine uses different libc (musl in case of Alpine).
If you try to run ps3netsrv-go executable from release directly on such distro, you'll get an error like
exec /path/to/ps3netsrv-go: no such file or directory
There are two ways to resolve this issue:
- Compile from source code for necessary libc. Recommended way. See Building for more details.
- Run with loader:
/lib/ld-musl-<arch>.so.1 /path/to/ps3netsrv-go. Downside:libchdrlikely will not be loaded so CHD support will be disabled.
To run as a service it's recommended to use NSSM. It allows to specify user, startup args and environment variables.
- Connect your console to the network using ethernet cable. To achieve maximum performance server and console should be connected with 1Gbps network.
- Use SSD or NVMe drive to store games. It will reduce loading times.
- Use decrypted ISOs. It will reduce CPU usage and loading times. You can decrypt images using
decryptsubcommand. - Use "compiled" ISOs instead of folder with files. It will reduce loading times.
You can build ISO image using
makeisosubcommand.
- Use limits:
- strict root to prevent possible directory traversal outside provided root:
--strict-rootflag - by IP address(es) using
--client-whitelistflag:$ ps3netsrv-go server --root=/home/games --client-whitelist=192.168.0.123 - by number of clients using
--max-clientsflag - idle connection time:
--read-timeoutflag
- strict root to prevent possible directory traversal outside provided root:
- To expose over NAT (non-public or "grey" IP) you can use:
- ngrok TCP tunnels
- Reverse SSH tunnel to host with public IP
- any other options
- To secure connection using TLS you may use two TLS-terminators (like HAProxy) configured with mutual TLS authentication. Note that desired terminator must support "wrapping" plain TCP connection to TLS with client certificate.
$ go mod download
$ go build -o ps3netsrv-go ./cmd/ps3netsrv-go/...Important
Some platforms require extra build flags to be compiled successfully due to purego usage. See support notes for details.
If you're building for non-glibc Linux distro (like Alpine) or building on non-glibc distro for glibc-based distro (like on Alpine for Ubuntu) you need to properly specify ldso path via GO_LDSO environment variable:
GO_LDSO=/lib/ld-musl-x86_64.so.1for Alpine on x86_64 architectureGO_LDSO=/lib64/ld-linux-x86-64.so.2for any glibc-based distro (Ubuntu/Debian/Arch/...) on x86_64 architecture