### S3ProxyServer Command-Line Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md Example of starting the S3ProxyServer with file storage, device credentials, and user management. This configuration enables graceful restart and specifies a maximum age for stored data. ```bash S3ProxyServer --store-file dtls.bin --store-max-age 168 \ --store-password64 ZVhiRW5pdkx1RUs2dmVoZg== \ --device-file devices.txt --user-file users.txt \ --https-credentials . --s3-config ~/.s3cfg ``` -------------------------------- ### GET Request Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-simplefile-server/README.md Example of how to perform a GET request to retrieve a file using the cf-helloworld-client. This retrieves 'file.bin' from the server's file root. ```sh java -jar cf-helloworld-client-.jar GETClient coap://localhost/data/file.bin file2save.bin ``` -------------------------------- ### Start ExampleProxy2HttpClient Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Launches an example HTTP client on the same host as the proxy. This is used to interact with the proxy's HTTP endpoint. ```shell java -jar cf-proxy2-.jar ExampleProxy2HttpClient ``` -------------------------------- ### Start ExampleSecureProxy2 with COAPS Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Starts the example cross-proxy with a co-located COAPS destination server. This is for testing secure CoAP communication. ```shell java -jar cf-proxy2-.jar ExampleSecureProxy2 coaps ``` -------------------------------- ### Start ExampleCrossProxy2 with CoAP and HTTP Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Starts the example cross-proxy with co-located coap and http destination servers. This command is used to initiate the proxy service for testing. ```shell java -jar cf-proxy2-.jar ExampleCrossProxy2 coap http ``` -------------------------------- ### Start ExampleProxy2CoapClient Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Launches an example CoAP client on the same host as the proxy. This is used to interact with the proxy's CoAP endpoint. ```shell java -jar cf-proxy2-.jar ExampleProxy2CoapClient ``` -------------------------------- ### Start S3ProxyServer with Help Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md Demonstrates how to start the S3ProxyServer and display its help message to view available command-line options. ```bash java -jar cf-s3-proxy-server-.jar -h ``` -------------------------------- ### DemoServer Example: With HTTPS Service Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Starts the DemoServer with device credentials, DTLS graceful restart, and an HTTP server on port 8080 using certificates from the current directory. ```sh DemoServer --store-file dtls.bin --store-max-age 168 \ --store-password64 ZVhiRW5pdkx1RUs2dmVoZg== \ --device-file devices.txt --https-credenitals . ``` -------------------------------- ### s3cmd Configuration Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/service/cloud-installs/README.md Example configuration for s3cmd, including host details, bucket name, and access keys. This file is used by the install script to access S3. ```bash [default] host_base = sos-de-fra-1.exo.io host_bucket = %(bucket)s.sos-de-fra-1.exo.io bucket = cali-demo- access_key = EXO secret_key = use_https = true ``` -------------------------------- ### Reverse Proxy GET Examples Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Demonstrates reverse proxy GET requests to different destinations, showing successful responses and etag information. ```sh Reverse-Proxy GET: coap://localhost/targets/destination1 etag: 0x4D4B9060 2.05/CONTENT --- Hi! I am the coap server on port 5685. Request 1. Reverse-Proxy GET: coap://localhost/targets/destination2 etag: 'cb329225', 0x6362333239323235 ``` -------------------------------- ### Device Store Configuration Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Example of a device store configuration file, demonstrating how to define devices and their associated credentials (PSK, RPK, x509). ```text # Device store for Cloud Demo Demo.10034780012=Thing .label=My Demo Weatherstation # default openssl PSK credentials .psk='Client_identity',c2VjcmV0UFNL # Californium demo-client RPK certificate .rpk=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQxYO5/M5ie6+3QPOaAy5MD6CkFILZwIb2rOBCX/EWPaocX1H+eynUnaEEbmqxeN6rnI/pH19j4PtsegfHLrzzQ== Demo.10560970055=Thing .psk='cali.0012345','secretPSK' # x509 CA (trust root) ca.1=Admin .type=ca .x509= ----BEGIN CERTIFICATE----- MIIB6jCCAZCgAwIBAgIIVcDMBTw+KzcwCgYIKoZIzj0EAwIwXDEQMA4GA1UEAxMH Y2Ytcm9vdDEUMBIGA1UECxMLQ2FsaWZvcm5pdW0xFDASBgNVBAoTC0VjbGlwc2Ug SW9UMQ8wDQYDVQQHEwZPdHRhd2ExCzAJBgNVBAYTAkNBMB4XDTI0MTEwNDE4MTUz MFoXDTI2MTEwNDE4MTUzMFowXDEQMA4GA1UEAxMHY2Ytcm9vdDEUMBIGA1UECxML Q2FsaWZvcm5pdW0xFDASBgNVBAoTC0VjbGlwc2UgSW9UMQ8wDQYDVQQHEwZPdHRh d2ExCzAJBgNVBAYTAkNBMBkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzx3KwWUN 2s7ad0CComh/dfNEg64Z7THbM64Bm8BOgFBN9284SSrboMvdAIOQamDP/aAmhFV3 6Qg/SF1A5qTW9qM8MDowHQYDVR0OBBYEFBifxGwtiNzNWfvoU9IdZYrqJqp3MAsG A1UdDwQEAwIBBjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0gAMEUCIGU7bo83 m29D12Tf2BA9DVC+48dpmib6FGwoxwIGyKGaAiEA0KXJd7IGpmcdxiroGJ+89+/2 TZIohp/YlALdHH1U/nU= -----END CERTIFICATE----- # x509 device certificate, signed by Ca Demo.40145780125=Thing .label=Door .x509= -----BEGIN CERTIFICATE----- MIICAjCCAaigAwIBAgIJAJvzugZ7RkwVMAoGCCqGSM49BAMCMFwxEDAOBgNVBAMT B2NmLXJvb3QxFDASBgNVBAsTC0NhbGlmb3JuaXVtMRQwEgYDVQQKEwtFY2xpcHNl IElvVDEPMA0GA1UEBxMGT3R0YXdhMQswCQYDVQQGEwJDQTAeFw0yNDExMDcxNTA5 MzVaFw0yNjExMDcxNTA5MzVaMGAxFDASBgNVBAMTC2NmLWNsaWVudC0yMRQwEgYD VQQLEwtDYWxpZm9ybml1bTEUMBIGA1UEChMLRWNsaXBzZSBJb1QxDzANBgNVBAcT Bk90dGF3YTELMAkGA1UEBhMCQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATa v2cItqEoanxb1UduhvKR+dlbkr0lsbR/ql01UPuAa2ONNt9uIl9FCXoF3V/VzE3O xW5+YTUraJ/CcuARZC5Mo08wTTAdBgNVHQ4EFgQU0d8npcBVyIxSwE9hPFTJ7qmZ 04owCwYDVR0PBAQDAgeAMB8GA1UdIwQYMBaAFBifxGwtiNzNWfvoU9IdZYrqJqp3 MAoGCCqGSM49BAMCA0gAMEUCIQC5F+tgTY5IzmbjlXqQE6ha/hFHE981mo0pSAzv NdTutwIgS0YrTmYDan4J8Z+svEG89HbLk2QlY2aGrzyjce7faSk= -----END CERTIFICATE----- ``` -------------------------------- ### Install Application on Kubernetes Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Use this command to perform the initial installation of the application on Kubernetes. Ensure that 'docker' and 'kubectl' are installed and configured. ```sh service/deploy_k8s.sh install ``` -------------------------------- ### DemoServer Example: External Network Only Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Starts the DemoServer listening only on external network interfaces, disabling loopback. ```sh DemoServer --no-loopback --device-file devices.txt ``` -------------------------------- ### Start Benchmark Server Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Command to start the benchmark server with specific JVM options for heap management and disabling plugtest. ```sh java -Xmx6g -XX:+UseG1GC -jar cf-extplugtest-server-.jar --benchmark --no-plugtest ``` -------------------------------- ### Basic HTTP Forwarding Proxy2 Example Source: https://github.com/eclipse-californium/californium/blob/main/californium-proxy2/README.md This example demonstrates the core components and setup for an HTTP forwarding proxy. It involves initializing a client endpoint, creating a proxy HTTP server, and configuring message deliverers for CoAP request translation and forwarding. ```java AddressEndpointContext proxy = new AddressEndpointContext(new InetSocketAddress("127.0.0.1", PROXY_PORT)); request.setDestinationContext(proxy); // not recommended! literal IP, same as proxy request.setURI("coap://127.0.0.1/coap-target"); request.getOptions().setUriHost("127.0.0.1"); ``` ```java AddressEndpointContext proxy = new AddressEndpointContext(new InetSocketAddress("127.0.0.1", PROXY_PORT)); request.setDestinationContext(proxy); // recommended! request.setURI("coap://localhost/coap-target"); ``` -------------------------------- ### Proxy URI and Scheme Examples Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Illustrates different ways to specify proxy URIs and schemes for GET requests, including successful proxying and error cases. ```sh Proxy-URI GET: http://localhost:8000/http-target etag: 'cb3291e7', 0x6362333239316537 2.05/CONTENT --- Hi! I am the Http Server on port 8000. Request 1. Proxy-URI GET: coap://localhost:5685/coap-target etag: 0x4D4B9060 2.05/CONTENT --- Hi! I am the coap server on port 5685. Request 1. Proxy-Scheme GET: http: coap://localhost:8000/http-target etag: 'cb329206', 0x6362333239323036 2.05/CONTENT --- Hi! I am the Http Server on port 8000. Request 2. Proxy GET: coap://localhost:5685/coap-target etag: 0x4D4B9060 2.05/CONTENT --- Hi! I am the coap server on port 5685. Request 1. Proxy GET: coap://127.0.0.1:5685/coap-target etag: 0x4D4B907F 2.05/CONTENT --- Hi! I am the coap server on port 5685. Request 2. Proxy GET: coap://127.0.0.1:5685/coap-target etag: 0x4D4B907F 2.05/CONTENT --- Hi! I am the coap server on port 5685. Request 2. Proxy-URI GET: http://user@localhost:8000/http-target => 4.00/BAD_REQUEST => 'Request URI authority contains deprecated userinfo component' 4.00/BAD_REQUEST --- Request URI authority contains deprecated userinfo component Proxy GET: coap://localhost/coap-target => 4.04/NOT_FOUND 4.04/NOT_FOUND ``` -------------------------------- ### Cloud-Init Configuration for Californium Installation Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-old-style-unix-systemd-service This cloud-init configuration automates the installation of Californium, including package upgrades, Java runtime, fail2ban, systemd service setup, and downloading the Californium server JAR and configuration files. ```yaml package_upgrade: true packages: - openjdk-17-jre-headless - fail2ban disable_root: false users: - name: cali gecos: (Cf) Californium Server lock_passwd: true no_user_group: true runcmd: - [ wget, "https://github.com/eclipse/californium/raw/main/demo-apps/cf-unix-setup/scripts/cali.service", -O, "/etc/systemd/system/cali.service" ] - [ wget, "https://repo.eclipse.org/content/repositories/californium-releases/org/eclipse/californium/cf-plugtest-server/4.0.0-M2/cf-plugtest-server-4.0.0-M2.jar", -O, "/home/cali/cf-plugtest-server-update.jar" ] - [ wget, "https://github.com/eclipse/californium/raw/main/demo-apps/cf-unix-setup/scripts/logback.xml", -O, "/home/cali/logback.xml" ] - [ systemctl, start, cali ] - [ systemctl, enable, cali ] - [ wget, "https://github.com/eclipse/californium/raw/main/demo-apps/cf-unix-setup/scripts/fail2ban/cali2fail.conf", -O, "/etc/fail2ban/jail.d/cali2fail.conf" ] - [ wget, "https://github.com/eclipse/californium/raw/main/demo-apps/cf-unix-setup/scripts/fail2ban/cali.conf", -O, "/etc/fail2ban/filter.d/cali.conf" ] - [ systemctl, restart, fail2ban ] ``` -------------------------------- ### Get MyContext Resource (Plain CoAP) Source: https://github.com/eclipse-californium/californium/blob/main/README.md Example of retrieving the 'mycontext' resource using a plain CoAP GET request. This shows basic client information like IP and port. ```bash > coap-client -p 15683 -m GET coap://californium.eclipseprojects.io/mycontext ip: 2a02:????:915b port: 15683 server: Cf 4.0.0-M6 ``` -------------------------------- ### Start ExampleSecureProxy2CoapClient Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Launches an example secure CoAP client (COAPS) on the same host as the proxy. This client interacts with the secure COAPS endpoint of the proxy. ```shell java -jar cf-proxy2-.jar ExampleSecureProxy2CoapClient ``` -------------------------------- ### Client GET Request to a Simple Server (UDP) Source: https://github.com/eclipse-californium/californium/blob/main/californium-core/README.md Example of a CoapClient making a GET request to a simple CoapServer. Assumes the server is running and accessible. ```java CoapConfig.register(); UdpConfig.register(); CoapClient client = new CoapClient("coap://"); Response response = client.get(); ... client.shutdown(); ``` -------------------------------- ### Install OpenJDK on Ubuntu Source: https://github.com/eclipse-californium/californium/wiki/Californium---running-the-sandbox-locally-for-integration-tests Install the headless Java Development Kit (OpenJDK) version 17 on Ubuntu systems using apt. ```bash sudo apt install openjdk-17-jre-headless ``` -------------------------------- ### Domain Configuration File Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md This example shows the structure of a domains.txt file, defining configurations for 'domain1' and 'domain2', including S3 bucket details, access keys, and management file paths. ```text [web] domain = domain1 [domain1.data] host_base = sos-de-fra-1.exo.io host_bucket = %(bucket)s.sos-de-fra-1.exo.io bucket = devices1 access_key = secret_key = compress = true [domain1.management] host_base = sos-de-fra-1.exo.io host_bucket = %(bucket)s.sos-de-fra-1.exo.io bucket = devices1mgmt access_key = secret_key = device_store = devices.txt config_store = configs.txt user_store = users.txt [domain2.data] host_base = sos-de-fra-1.exo.io host_bucket = %(bucket)s.sos-de-fra-1.exo.io bucket = devices2 access_key = secret_key = compress = true [domain2.management] host_base = sos-de-fra-1.exo.io host_bucket = %(bucket)s.sos-de-fra-1.exo.io bucket = devices2mgmt access_key = secret_key = device_store = devices.txt config_store = configs.txt user_store = users.txt ``` -------------------------------- ### Benchmark Client and Server Interaction Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Example output showing the creation of benchmark clients, sending requests, and receiving responses, including DTLS handshake details and performance metrics. ```text Create 2000 none-stop secure benchmark clients, expect to send 1000000000 requests overall to coaps://????:5784/benchmark?rlen=40 Use PSK. 11:18:56.200: Request: ==[ CoAP Request ]============================================= MID : 39238 Token : CCD3FF946AE68279 Type : CON Method : 0.02 - POST Options: {"Uri-Host":"???", "Uri-Path":"benchmark", "Content-Format":"text/plain", "Uri-Query":"rlen=40", "Accept":"text/plain"} Payload: 0 Bytes =============================================================== 11:18:56.216: >>> CONNECTING <<< 11:18:56.497: >>> DTLS(????:??,ID:2FB1132D5E) >>> TLS_PSK_WITH_AES_128_CCM_8 >>> PreSharedKey Identity [identity: cali.A2F2E01AC4C5C52E] >>> read-cid : >>> write-cid: 89B3BE674AA2 11:18:56.509: Received response: ==[ CoAP Response ]============================================ MID : 39238 Token : CCD3FF946AE68279 Type : ACK Status : 2.04 - CHANGED Options: {"Content-Format":"text/plain"} RTT : 316 ms Payload: 40 Bytes --------------------------------------------------------------- hello benchmark************************* =============================================================== Benchmark clients, first request successful. Benchmark clients created. 668 ms, 2993 clients/s 11:18:57.499: register shutdown hook. Benchmark started. 286184 requests (28618 reqs/s, 5005 retransmissions (1,72%), 0 transmission errors (0,00%), 2000 clients) 601072 requests (31489 reqs/s, 6575 retransmissions (2,09%), 0 transmission errors (0,00%), 2000 clients) 945326 requests (34425 reqs/s, 6687 retransmissions (1,94%), 0 transmission errors (0,00%), 2000 clients) 1296353 requests (35103 reqs/s, 6652 retransmissions (1,89%), 0 transmission errors (0,00%), 2000 clients) 1643276 requests (34692 reqs/s, 6716 retransmissions (1,94%), 0 transmission errors (0,00%), 2000 clients) 1991747 requests (34847 reqs/s, 6770 retransmissions (1,94%), 0 transmission errors (0,00%), 2000 clients) 2337099 requests (34535 reqs/s, 6711 retransmissions (1,94%), 0 transmission errors (0,00%), 2000 clients) 2678691 requests (34159 reqs/s, 6704 retransmissions (1,96%), 0 transmission errors (0,00%), 2000 clients) 3025392 requests (34670 reqs/s, 6726 retransmissions (1,94%), 0 transmission errors (0,00%), 2000 clients) 3367248 requests (34186 reqs/s, 6768 retransmissions (1,98%), 0 transmission errors (0,00%), 2000 clients) ... ``` -------------------------------- ### Get MyContext Resource (CoAPS with PSK) Source: https://github.com/eclipse-californium/californium/blob/main/README.md Example of retrieving the 'mycontext' resource using CoAPS with a Pre-Shared Key (PSK). This demonstrates secure communication and provides more detailed client and session information. ```bash > coap-client -p 15684 -m GET -u Client_identity -k secretPSK coaps://californium.eclipseprojects.io/mycontext ip: 2a02:????:915b port: 15684 peer: Client_identity cipher-suite: TLS_PSK_WITH_AES_128_CCM_8 session-id: 3BBC6EBAAA4F4A4717EEC8FF2C3FB1CFC4C9C89E9807EB0F1C0CDC11C6D9110C read-cid: 1CF2CC41B37E write-cid: secure-renegotiation: true ext-master-secret: true newest-record: true message-size-limit: 1343 server: Cf 4.0.0-M6 ``` -------------------------------- ### Start a Simple CoapServer (UDP) Source: https://github.com/eclipse-californium/californium/blob/main/californium-core/README.md Shows how to start a basic CoapServer listening on the default CoAP port (5683) for UDP transport. Ensure CoapConfig and UdpConfig are registered. ```java CoapConfig.register(); UdpConfig.register(); CoapServer server = new CoapServer(); server.start() ... server.destroy(); ``` -------------------------------- ### Start Node 2 (Static Mode) Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Starts node 2 with a static cluster configuration, specifying its own and another node's cluster management interface. ```sh java -jar target/cf-extplugtest-server-.jar --dtls-cluster "---;localhost:15884;1,:25784;localhost:25884;2" ``` -------------------------------- ### Start Node 1 (Static Mode) Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Starts node 1 with a static cluster configuration, specifying its own and another node's cluster management interface. ```sh java -jar target/cf-extplugtest-server-.jar --dtls-cluster ":15784;localhost:15884;1,---;localhost:25884;2" ``` -------------------------------- ### cf-nat Console Output Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Example console output from the cf-nat load balancer indicating that reverse address update is enabled and showing the current destination entries. ```text 0 NAT entries, reverse address update enabled. 2 destinations. Destination: :15784, usage: 0 Destination: :25784, usage: 0 ``` -------------------------------- ### Starting Californium Java Process in Container Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-k8s-service Configures the entry point for the container, starting the Californium server JAR with specific JVM flags and command-line arguments for Kubernetes integration. ```dockerfile WORKDIR /opt/app CMD ["java", "-XX:+UseContainerSupport", "-XX:MaxRAMPercentage=75", "-jar", "./cf-extplugtest-server.jar", "--no-plugtest", "--no-tcp", "--benchmark", "--k8s-dtls-cluster", ":5784;:5884;5884", "--k8s-monitor", ":8080", "--k8s-restore", ":5884"] ``` -------------------------------- ### Cloud-Init Configuration for Californium Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-unix-setup/README.md This cloud-init configuration installs necessary packages, sets up the Californium service, and configures fail2ban. It's designed for automatic installation on cloud VMs. ```yaml package_upgrade: true packages: - openjdk-17-jre-headless - fail2ban disable_root: false users: - name: cali gecos: (Cf) Californium Server lock_passwd: true no_user_group: true runcmd: - [ wget, "https://github.com/eclipse-californium/californium/raw/main/demo-apps/cf-unix-setup/scripts/cali.service", -O, "/etc/systemd/system/cali.service" ] - [ wget, "https://repo.eclipse.org/content/repositories/californium-releases/org/eclipse/californium/cf-plugtest-server/4.0.0-M6/cf-plugtest-server-4.0.0-M6.jar", -O, "/home/cali/cf-plugtest-server-update.jar" ] - [ wget, "https://github.com/eclipse-californium/californium/raw/main/demo-apps/cf-unix-setup/scripts/logback.xml", -O, "/home/cali/logback.xml" ] - [ systemctl, start, cali ] - [ systemctl, enable, cali ] - [ wget, "https://github.com/eclipse-californium/californium/raw/main/demo-apps/cf-unix-setup/scripts/fail2ban/cali2fail.conf", -O, "/etc/fail2ban/jail.d/cali2fail.conf" ] - [ wget, "https://github.com/eclipse-californium/californium/raw/main/demo-apps/cf-unix-setup/scripts/fail2ban/cali.conf", -O, "/etc/fail2ban/filter.d/cali.conf" ] - [ sleep, 5 ] - [ systemctl, restart, fail2ban ] ``` -------------------------------- ### Specialized Reverse Proxy - Get Destination URI Source: https://github.com/eclipse-californium/californium/blob/main/californium-proxy2/README.md Example of how to get the destination URI for a request in a specialized reverse proxy implementation. ```java URI destination = translator.getDestinationURI(incomingRequest, exposedInterface); ``` -------------------------------- ### Cloud Demo Server Command Line Help Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Displays the available command-line options and arguments for starting the Cloud Demo Server. ```sh java -jar cf-cloud-demo-server-.jar -h Usage: CloudDemoServer [-h] [--diagnose] [--wildcard-interface | [[--[no-] loopback] [--[no-]external] [--[no-]ipv4] [--[no-]ipv6] [--interfaces-pattern=[, ...]]...]] [--coaps-credentials= [--coaps-password64=]] [--device-file= [--device-file-password64=]] [--store-file= --store-max-age= [--store-password64=]] [--provisioning [--replace]] [[--https-port=] --https-credentials= [--https-password64=]] --coaps-credentials= Folder containing coaps credentials in 'privkey. pem' and 'pubkey.pem' --coaps-password64= Password for device store. Base 64 encoded. --device-file= Filename of device store for coap. --device-file-password64= Password for device store. Base 64 encoded. --diagnose enable 'diagnose'-resource. -h, --help display a help message --https-credentials= Folder containing https credentials in 'privkey. pem' and 'fullchain.pem'. --https-password64= Password for https credentials. Base 64 encoded. --https-port= Port of https service. Default: 8080 --interfaces-pattern=[,...] interface regex patterns for coap endpoints. --[no-]external enable coap endpoints on external network. --[no-]ipv4 enable coap endpoints for ipv4. --[no-]ipv6 enable coap endpoints for ipv6. --[no-]loopback enable coap endpoints on loopback network. --provisioning enable 'prov'-resource for auto-provisioning. --replace replaces previous device credentials entries with new entries. For use during development. Don't use it for production! --store-file= file-store for dtls state. --store-max-age= maximum age of connections in hours to store dtls state. --store-password64= password to store dtls state. Base 64 encoded. --wildcard-interface Use local wildcard-address for coap endpoints. Default mode. ``` -------------------------------- ### Send GET Request using CoapClient (DTLS) Source: https://github.com/eclipse-californium/californium/blob/main/californium-core/README.md Demonstrates sending a CoAP GET request over DTLS using CoapClient. Requires DTLS endpoint setup and registration with EndpointManager. ```java CoapConfig.register(); DtlsConfig.register(); // some DTLS endpoint setup as above CoapEndpoint endpoint = CoapEndpoint.builder() .setConnector(new DTLSConnector(dtlsConfiguration)) .build(); EndpointManager.getEndpointManager().setDefaultEndpoint(endpoint); CoapClient client = new CoapClient("coaps://californium.eclipseprojects.io/test"); Response response = client.get(); ... client.shutdown(); ``` -------------------------------- ### Deploy Cloud Demo Server with ExoScale Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md This command creates an ExoScale cloud VM, installs the cloud-demo-server, generates RPK keys, adjusts file permissions, and reboots the VM. It sets up initial PSK credentials that should be replaced. ```sh ./deploy-dev.sh exo create install ``` -------------------------------- ### DemoServer Example: Device Credentials and DTLS Graceful Restart Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Configures the DemoServer with device credentials from a file and enables DTLS graceful restart. Skips devices/sessions with no exchange for over a week when saving. ```sh DemoServer --store-file dtls.bin --store-max-age 168 \ --store-password64 ZVhiRW5pdkx1RUs2dmVoZg== \ --device-file devices.txt ``` -------------------------------- ### Client GET Requests with Mapped Paths Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-simplefile-server/README.md Examples of client GET requests to retrieve files using the mapped CoAP URIs. These requests target specific files within the server's configured path root. ```sh java -jar cf-helloworld-client-.jar GETClient coap://localhost/files/cf_64.png picture2save.png java -jar cf-helloworld-client-.jar GETClient coap://localhost/files/fw/device.hex firmware.hex ``` -------------------------------- ### Device Credentials after Provisioning Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Example of device credentials after successful provisioning, including the device ID, RPK, and signature. ```text ... # added 2024-08-11T07:00:19Z by Provisioning1 device-id=Thing .rpk=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEe7jf4/mFVId9GnUfFdV1XQVUAn4fAKsctXYfLnrcvKMXAPAKe6mLPNMNxXf/+TsDQDXEcamWAcjDUFVc/9pIeQ== .sig=BAMARzBFAiEAkL9amzTcqBrovw3EPeUJ+iB/NhiEhgS603VBGDx6UUMCIDNfKVwOG7aCQVnsL7mDqgQZhXW7XrCMEKp0hAk7wGac ``` -------------------------------- ### Device Provisioning with RPK Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-cloud-demo-server/README.md Example of device provisioning using RPK credentials. This entry includes a name, the public key, and the type set to 'prov'. ```text Provisioning1=Admin .rpk=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENTGXGkhc7gL614R4HBOkXoESM98YIXP3yts4VG7wpRlsIxYFFXVez3I3VE7oGaOpLlAMMhFa4Myq/4OIRMvauQ== .type=prov ``` -------------------------------- ### Example: Forward traffic to multiple destinations Source: https://github.com/eclipse-californium/californium/blob/main/cf-utils/cf-nat/README.md Starts a (s)NAT listening on UDP port 5684 on any interface, forwarding traffic to three specified DTLS receivers. Assumes the destinations offer the service on the given ports. ```sh java -jar cf-nat-.jar :5684 node1.coap.cluster:5684 node2.coap.cluster:5684 node2.coap.cluster:5784 ``` -------------------------------- ### Retrieve Firmware from S3 Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md Use coap-client to GET firmware from the S3 proxy server. This example shows how to retrieve firmware for a specific device type and version using RFC 7959 (CoAP blockwise transfer). ```sh coap-client -v 6 -m GET -u Client_identity -k secretPSK coaps://${s3proxy}/fw/box/0.11.107+0 ``` -------------------------------- ### Device Store Configuration Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md Defines a device entry for the Cloud Demo Server, including its label, PSK credentials, RPK certificate, forwarding destination, authentication, and response patterns. This format is used for device management. ```properties Demo.10034780012=Thing .label=My Demo Weatherstation # default openssl PSK credentials .psk='Client_identity',c2VjcmV0UFNL # Californium demo-client RPK certificate .rpk=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQxYO5/M5ie6+3QPOaAy5MD6CkFILZwIb2rOBCX/EWPaocX1H+eynUnaEEbmqxeN6rnI/pH19j4PtsegfHLrzzQ== .fdest=https://api.tago.io/data .fauth=Header device-token: ????????-????-????-????-???????????? .fresp=.*"status":\s*true,.* ``` -------------------------------- ### Install Fail2ban Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-old-style-unix-systemd-service Installs the Fail2ban service on Debian-based systems. ```bash sudo apt install fail2ban ``` -------------------------------- ### Build and Tag Docker Image in One Step Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-k8s-service Builds a Docker image from a Dockerfile and tags it for a cloud registry simultaneously. Specify the correct path to your Dockerfile. ```bash > docker build . -t /cf-extserver-jdk11-slim -f service/Dockerfile ``` -------------------------------- ### Install OpenJDK 11 JRE (Ubuntu 18.04) Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-old-style-unix-systemd-service Installs the OpenJDK 11 JRE with headless support on Ubuntu 18.04 LTS. This is an alternative Java installation for Californium. ```bash sudo apt install openjdk-11-jre-headless ``` -------------------------------- ### Start Californium Service Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-old-style-unix-systemd-service Use this command to start the Californium systemd service. ```bash sudo systemctl start cali ``` -------------------------------- ### Run Californium Plugtest Server Source: https://github.com/eclipse-californium/californium/wiki/Californium---running-the-sandbox-locally-for-integration-tests Start the Californium plugtest server by executing its JAR file from the command line in the directory where it was downloaded. ```bash java -jar cf-plugtest-server-4.0.0-M2.jar ``` -------------------------------- ### Initialize PubSub Client Source: https://github.com/eclipse-californium/californium/blob/main/cf-pubsub/README.md Instantiate the PubSub client with the broker's address and optional port and timeout. ```java PubSub pubsub = new PubSub("127.0.0.1"); OR PubSub pubsub = new PubSub("127.0.0.1", 5683, 5000); ``` -------------------------------- ### PEM Private Key Example Source: https://github.com/eclipse-californium/californium/blob/main/element-connector/README.md Example of a PEM-encoded EC private key. This format is base64 encoded with descriptive comments. ```text -----BEGIN EC PRIVATE KEY----- MHcCAQEEIBw7lyMR21FDpCecT0bNr4oKBuYw1VdNnCB5xSS4dQrcoAoGCCqGSM49 AwEHoUQDQgAETY8Y02TZuaRUQvXnguxg6EPN7wR5vzxthmDk+6vvf6oJgBylWIU2 E3khCBkZM9Um7JCA9/kcbNezwJDzyQAnIw== -----END EC PRIVATE KEY----- ``` -------------------------------- ### S3ProxyServer Basic Configuration Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md Launches the S3ProxyServer with specified S3 configuration, DTLS state storage, and device/user files. This is a common setup for persistent device and user management. ```bash S3ProxyServer --store-file dtls.bin --store-max-age 168 \ --store-password64 ZVhiRW5pdkx1RUs2dmVoZg== \ --device-file devices.txt --user-file users.txt \ --s3-config ~/.s3cfg ``` -------------------------------- ### CoAP GET and PUT Requests Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-proxy2/README.md Shows a CoAP GET request with detailed response information and PUT requests with and without payload. ```sh === GET http://californium.eclipseprojects.io:5683/test/coap: === HTTP/1.1 200 OK Cache-Control: max-age=30 content-type: text/plain; charset=ISO-8859-1 Date: So., 20 Okt. 2024 15:20:27 GMT Content-Length: 61 Type: 0 (CON) Code: 1 (GET) MID: 1658 Token: F08EF92E7C93E122 === PUT http://californium.eclipseprojects.io:5683/test/coap: === (no payload) HTTP/1.1 204 No Content Date: So., 20 Okt. 2024 15:20:27 GMT === PUT http://californium.eclipseprojects.io:5683/test/coap: === '' HTTP/1.1 204 No Content Date: So., 20 Okt. 2024 15:20:27 GMT === PUT http://californium.eclipseprojects.io:5683/test/coap: === '1234' HTTP/1.1 204 No Content Date: So., 20 Okt. 2024 15:20:27 GMT ``` -------------------------------- ### Run Simple File Server Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-simplefile-server/README.md Start the Simple File Server JAR. Optionally specify the file root directory and the CoAP root path for accessing files. ```sh java -jar cf-simplefile-server-.jar [--file-root=] [--path-root=] ``` -------------------------------- ### Deploy Cloud CoAP-S3-Proxy Server with ExoScale Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-s3-proxy-server/README.md This command creates an ExoScale cloud VM, installs the Cloud CoAP-S3-Proxy server, and configures it. It sets up initial PSK credentials that should be replaced. ```sh ./deploy-dev.sh exo create create-bucket install ``` -------------------------------- ### Install OpenJDK 8 JRE (Ubuntu 18.04) Source: https://github.com/eclipse-californium/californium/wiki/Californium-as-old-style-unix-systemd-service Installs the OpenJDK 8 JRE with headless support on Ubuntu 18.04 LTS. This is a prerequisite for running Californium. ```bash sudo apt install openjdk-8-jre-headless ``` -------------------------------- ### Start Node 3 (Dynamic Mode) Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Starts node 3 in dynamic cluster mode, specifying its own cluster management interface and a group of interfaces for other nodes. ```sh java -jar target/cf-extplugtest-server-.jar --dtls-cluster ":35784;localhost:35884;3" --dtls-cluster-group="localhost:15884,localhost:25884" ``` -------------------------------- ### Run Server with Custom Logback Configuration Source: https://github.com/eclipse-californium/californium/wiki/Californium---running-the-sandbox-locally-for-integration-tests Start the Californium plugtest server using a custom logback.xml file to control logging output. This command specifies the logback configuration file to use. ```bash java -Dlogback.configurationFile=./logback.xml -jar cf-plugtest-server-4.0.0-M2.jar ``` -------------------------------- ### Start Node 2 (Dynamic Mode) Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Starts node 2 in dynamic cluster mode, specifying its own cluster management interface and a group of interfaces for other nodes. ```sh java -jar target/cf-extplugtest-server-.jar --dtls-cluster ":25784;localhost:25884;2" --dtls-cluster-group="localhost:15884,localhost:35884" ``` -------------------------------- ### Example C-Header Content Source: https://github.com/eclipse-californium/californium/blob/main/cf-utils/cf-encrypt/README.md Illustrates the content of a generated C-header file for a private key, showing the BEGIN/END markers and base64 encoded data. ```c "-----BEGIN PRIVATE KEY-----\n" "MEEC.........................................................Clu\n" "VT4l.....................w==\n" "-----END PRIVATE KEY-----\n" ``` -------------------------------- ### Start Node 1 (Dynamic Mode) Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-extplugtest-server/README.md Starts node 1 in dynamic cluster mode, specifying its own cluster management interface and a group of interfaces for other nodes. ```sh java -jar target/cf-extplugtest-server-.jar --dtls-cluster ":15784;localhost:15884;1" --dtls-cluster-group="localhost:25884,localhost:35884" ``` -------------------------------- ### File System Mapping Example Source: https://github.com/eclipse-californium/californium/blob/main/demo-apps/cf-simplefile-server/README.md Demonstrates how to map a file system structure to CoAP URIs using --file-root and --path-root options. Files in the specified file system tree are accessed via the CoAP path root. ```sh java -jar cf-simplefile-server-.jar --file-root=/home/cali/data --path-root=files --no-tcp ```