From f2d53eee42e26249ad68be9b21ffd5133524a294 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 9 Feb 2026 13:24:22 -0800 Subject: [PATCH 1/5] Update README --- README.md | 158 ++++++++++++++++++++++++++++--- docs/validators.md | 225 --------------------------------------------- 2 files changed, 146 insertions(+), 237 deletions(-) delete mode 100644 docs/validators.md diff --git a/README.md b/README.md index fab0c5f4..9f3bb32b 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,160 @@ # OpenAudio Protocol -[![license](https://img.shields.io/github/license/AudiusProject/audiusd)](https://github.com/AudiusProject/audiusd/blob/main/LICENSE) [![releases](https://img.shields.io/github/v/release/AudiusProject/audiusd)](https://github.com/AudiusProject/audiusd/releases/latest) +[![license](https://img.shields.io/github/license/OpenAudio/go-openaudio)](https://github.com/OpenAudio/go-openaudio/blob/main/LICENSE) [![releases](https://img.shields.io/github/v/release/OpenAudio/go-openaudio)](https://github.com/OpenAudio/go-openaudio/releases/latest) > A golang implementation of the OpenAudio protocol. -#### [docs/validators.md](docs/validators.md) -Run and maintain an Audius Protocol Validator, secure the network. +# Quickstart -#### [docs/developers.md](docs/developers.md) -Build the future of decentralized music distribution. +```bash +docker run --rm -it -p 80:80 -p 443:443 openaudio/go-openaudio:stable +open https://localhost/console/overview +``` + + +To run a validator and secure the network, visit [docs.openaudio.org](https://docs.openaudio.org/tutorials/run-a-node). + + +# Local Development + +## Prerequisites + +Ensure the following are installed: ---- +* Docker +* Docker Compose +* Go v1.25 -### Quickstart +The remaining dependencies can then be automatically installed with `make`: ```bash -docker run --rm -it -p 80:80 -p 443:443 audius/openaudio:v1.0.0 -open https://localhost/console/overview +make install-deps +``` + +## Running local devnet + +You can simulate an openaudio network by running multiple nodes on your machine. This makes developing certain features fast and easy. + +### Setup + +Add the following hosts to your `/etc/hosts` file: + +```bash +echo "127.0.0.1 node1.oap.devnet node2.oap.devnet node3.oap.devnet node4.oap.devnet" | sudo tee -a /etc/hosts +``` + +Then add the local dev x509 cert to your keychain so you will have green ssl in your browser. + +```bash +sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dev/tls/cert.pem +``` + +### Run + +Build and run a local devnet with 4 nodes. + +```bash +make up +``` + +**Access the dev nodes** + +```bash +# add -k if you don't have the cert in your keychain +curl https://node1.oap.devnet/health-check +curl https://node2.oap.devnet/health-check +curl https://node3.oap.devnet/health-check +curl https://node4.oap.devnet/health-check + +# view in browser (quit and re-open if you added the cert and still get browser warnings) +open https://node1.oap.devnet/console +open https://node2.oap.devnet/console +open https://node3.oap.devnet/console +open https://node4.oap.devnet/console ``` ---- +**Smoke test** -### Node Operators +```bash +# after 5-10s there should be 4 nodes registered +# this validates that the registry bridge is working, +# as only nodes 1 and 2 are defined in the genesis file as validators + +$ curl -s https://node1.oap.devnet/core/nodes | jq . +{ + "data": [ + "https://node2.oap.devnet", + "https://node1.oap.devnet", + "https://node3.oap.devnet", + "https://node4.oap.devnet" + ] +} + +# or in the UI +open https://node1.oap.devnet/console/nodes + +# view uptime across the network +open https://node1.oap.devnet/console/uptime +``` -Migrate an existing [content node](docs/validators.md#existing-content-nodes) or [discovery node](docs/validators.md#existing-discovery-nodes) to the OpenAudio Protocol. +> Note: +> By default, hot reloading is only enabled on node1.oap.devnet to conserve system resources. +> To enable on other nodes, update the corresponding env file in [dev/env](../dev/env). + +## Develop against stage or prod + +Build a local docker image + +```bash +make docker-dev +``` + +Peer with mainnet + +```bash +docker run --rm -it -p 80:80 -p 443:443 -e NETWORK=prod openaudio/go-openaudio:dev +``` + +## Run tests + +Run all tests + +```bash +make test +``` + +Run only storage service tests + +```bash +make test-mediorum +``` + +Run only unittests +```bash +make test-unit +``` + +Run only integration tests +```bash +make test-integration +``` + +### ETL + +The ETL service indexes blockchain data into the postgres database, enabling faster queries for certain views. + +```bash +OPENAUDIO_ETL_ENABLED=true +``` + +### Explorer + +The Explorer provides a web-based interface to browse blocks, transactions, validators, and other data. If enabled, the explorer runs at the site root, e.g. https://node1.oap.devnet/. Explorer requires ETL. + +```bash +OPENAUDIO_ETL_ENABLED=true +OPENAUDIO_EXPLORER_ENABLED=true + +# View explorer in browser +open https://node1.oap.devnet/ +``` diff --git a/docs/validators.md b/docs/validators.md deleted file mode 100644 index efff13bf..00000000 --- a/docs/validators.md +++ /dev/null @@ -1,225 +0,0 @@ -# Validator Setup - -This guide provides migration instructions for existing nodes that are currently using `audiusd`. - -Create an `override.env` file. - -```bash -# /home/ubuntu/override.env - -nodeEndpoint=https://cn1.operator.xyz -delegateOwnerWallet=0x01234567890abcdef01234567890abcdef012345 -delegatePrivateKey=01234567890abcdef01234567890abcdef01234567890abcdef01234567890ab -spOwnerWallet=0x01234567890abcdef01234567890abcdef012345 - -# uncomment if using s3 for blob storage -#AUDIUS_STORAGE_DRIVER_URL=s3://my-s3-bucket -#AWS_REGION=us-west-2 -#AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX -#AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - -# uncomment if using gcs for blob storage -# you will need an additional mount for the credentials -# i.e. `-v google-application-credentials.json:/tmp/google-application-credentials.json` -#AUDIUS_STORAGE_DRIVER_URL=gs://my-gcs-bucket -#GOOGLE_APPLICATION_CREDENTIALS=/tmp/google-application-credentials.json - -# uncomment if using cloudflare proxy -#OPENAUDIO_TLS_SELF_SIGNED=true -``` - -Run your node. - -```bash -docker run -d \ - --name openaudio-cn1.operator.xyz \ - --restart unless-stopped \ - --env-file /home/ubuntu/override.env \ - -v /var/k8s/creator-node-db-15:/data/creator-node-db-15 \ - -v /var/k8s/bolt:/data/bolt \ - -v /var/k8s/mediorum:/tmp/mediorum \ - -p 80:80 \ - -p 443:443 \ - -p 26656:26656 \ - audius/openaudio:v1.0.0 -``` - -## Health Check - -```bash -curl https://node.operator.xyz/health-check | jq . - -# values are examples -{ - "core": { - "chainId": "audius-mainnet", - "cometAddress": "1A2B3C4D5E6F7G8H9I0J1K2L3M4N5O6P7Q8R", - "errors": [], - "ethAddress": "0x1234567890123456789012345678901234567890", - "healthy": true, - "totalBlocks": 123456, - "totalTransactions": 789012 - }, - "git": "abcdef0123456789abcdef0123456789abcdef01", - "hostname": "node.operator.xyz", - "storage": { - # discovery nodes will have storage disabled - "enabled": false, - # content nodes will have storage enabled + additional fields - "enabled": true, - "service": "content-node", - "...": "..." - }, - "timestamp": "2024-01-01T12:00:00.000000000Z", - "uptime": "24h0m0.000000000s" -} -``` - -## Autonomous Update - -To create the update script, copy and paste this. - -```bash -cat << 'EOF' > /home/ubuntu/openaudio-update.sh -#!/bin/bash - -OPENAUDIO_HOSTNAME="PLACEHOLDER_HOSTNAME" -OVERRIDE_ENV_PATH="PLACEHOLDER_ENV_PATH" -OPENAUDIO_VERSION="${OPENAUDIO_VERSION:-v1.0.0}" - -FORCE_UPDATE=false -if [[ "$1" == "--force" ]]; then - FORCE_UPDATE=true -fi - -PULL_STATUS=$(docker pull audius/openaudio:${OPENAUDIO_VERSION} | tee /dev/stderr) -if $FORCE_UPDATE || ! echo "$PULL_STATUS" | grep -q 'Status: Image is up to date'; then - echo "New version found or force update requested, updating container..." - docker stop openaudio-${OPENAUDIO_HOSTNAME} - docker rm openaudio-${OPENAUDIO_HOSTNAME} - docker run -d \ - --name openaudio-${OPENAUDIO_HOSTNAME} \ - --restart unless-stopped \ - --env-file ${OVERRIDE_ENV_PATH} \ - -v /var/k8s:/data \ - -p 80:80 \ - -p 443:443 \ - -p 26656:26656 \ - audius/openaudio:${OPENAUDIO_VERSION} - echo "Update complete" -else - echo "Already running latest version" -fi -EOF -``` - -Copy the below command and replace `node.operator.xyz` with your actual node hostname. - -```bash -sed -i "s/PLACEHOLDER_HOSTNAME/node.operator.xyz/" /home/ubuntu/openaudio-update.sh -``` - -Copy the below command and replace `/home/ubuntu/override.env` with the full path to your node's override.env file that you created earlier. - -```bash -sed -i "s|PLACEHOLDER_ENV_PATH|/home/ubuntu/override.env|" /home/ubuntu/openaudio-update.sh -``` - -Make the script executable and install it system-wide. - -```bash -chmod +x /home/ubuntu/openaudio-update.sh -sudo mv /home/ubuntu/openaudio-update.sh /usr/local/bin/openaudio-update -``` - -Add a cron to run the update script on a random minute of each hour (staggers updates across network): - -```bash -(crontab -l | grep -v "# openaudio auto-update"; echo "$(shuf -i 0-59 -n 1) * * * * /usr/local/bin/openaudio-update >> /home/ubuntu/openaudio-update.log 2>&1 # openaudio auto-update") | crontab - -``` - -Check the cron job was added successfully. - -```bash -crontab -l -``` - -The output should look something like... -```bash -54 * * * * /usr/local/bin/openaudio-update >> /home/ubuntu/openaudio-update.log 2>&1 # openaudio auto-update -``` - -**Done!** - -Additionally, you can run the update script manually: - -```bash -openaudio-update [--force] -``` - -Check the auto-update logs: - -```bash -tail -f /home/ubuntu/openaudio-update.log -``` - -## Additional Configuration - -### Ports - -Your node requires three open ports for full participation: - -- 80 -- 443 -- 26656 - -### TLS - -**Option 1: Default Setup** - -On first boot, nodes will attempt to use LetsEncrypt for TLS certification. - -1. The certification process takes ~60 seconds -2. Your node must be publicly accessible via its hostname -3. Both ports 80 and 443 must be open - -**Option 2: Cloudflare Proxy** - -```bash -# LetsEncrypt challenges cannot pass under Cloudflare's strict proxy mode -OPENAUDIO_TLS_SELF_SIGNED=true -``` - -**Option 3: Custom SSL Setup** -```bash -# Disable built-in TLS if using your own SSL termination -OPENAUDIO_TLS_DISABLED=true - -# Optional: Configure custom ports -OPENAUDIO_HTTP_PORT=80 # Default -OPENAUDIO_HTTPS_PORT=443 # Default -``` - -### Blob Storage - -Validators support cloud blob storage such as s3, gcs, and azure as an efficient, scalable, and reliable alternative to local disk storage. - -If using s3-compatible blob storage with a cloud provider other than AWS, please note that the `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY` environment variables are still required to be set in your config and will function similarly using your custom provider's application access key and region. - -In addition, please ensure the `AUDIUS_STORAGE_DRIVER_URL` environment variable is set using the following format: - -```bash -AUDIUS_STORAGE_DRIVER_URL=s3://?endpoint=https:// -``` - -### Node Participation Levels - -**Validators** -- Participates in consensus, block proposals, and transaction relay -- Requires peering over port `26656` -- Requires [registration](https://docs.openaudio.org/tutorials/run-a-node#node-registration) - -**Peers** -- Does not participate in consensus, able to download blocks and serve RPC queries -- Does not require registration -- Does not require peering over port `26656` From 928389a16d15d4e54e8ace5f1d9511abb1a7baf8 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 9 Feb 2026 13:48:03 -0800 Subject: [PATCH 2/5] Fix no storage config --- README.md | 9 ++++++++- pkg/mediorum/server/connect.go | 21 ++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9f3bb32b..fcb74372 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,14 @@ # Quickstart ```bash -docker run --rm -it -p 80:80 -p 443:443 openaudio/go-openaudio:stable +docker run --rm -it \ + -p 80:80 \ + -p 443:443 \ + -p 26656:26656 \ + -e OPENAUDIO_TLS_SELF_SIGNED=true \ + -e OPENAUDIO_STORAGE_ENABLED=false \ + openaudio/go-openaudio:stable + open https://localhost/console/overview ``` diff --git a/pkg/mediorum/server/connect.go b/pkg/mediorum/server/connect.go index f272c2cd..fa68967a 100644 --- a/pkg/mediorum/server/connect.go +++ b/pkg/mediorum/server/connect.go @@ -39,6 +39,9 @@ func (s *StorageService) Ping(context.Context, *connect.Request[v1.PingRequest]) // GetUpload implements v1connect.StorageServiceHandler. func (s *StorageService) GetUpload(ctx context.Context, req *connect.Request[v1.GetUploadRequest]) (*connect.Response[v1.GetUploadResponse], error) { + if s.mediorum == nil { + return nil, connect.NewError(connect.CodeUnavailable, errors.New("storage service not initialized")) + } dbUpload, err := s.mediorum.serveUpload(ctx, req.Msg.Id, req.Msg.Fix, req.Msg.Analyze) if err != nil { return nil, err @@ -104,6 +107,9 @@ func (s *StorageService) GetUpload(ctx context.Context, req *connect.Request[v1. // UploadFiles implements v1connect.StorageServiceHandler. func (s *StorageService) UploadFiles(ctx context.Context, req *connect.Request[v1.UploadFilesRequest]) (*connect.Response[v1.UploadFilesResponse], error) { + if s.mediorum == nil { + return nil, connect.NewError(connect.CodeUnavailable, errors.New("storage service not initialized")) + } placeHosts := strings.Join(req.Msg.PlacementHosts, ",") files := make([]*multipart.FileHeader, len(req.Msg.Files)) for i, file := range req.Msg.Files { @@ -189,6 +195,9 @@ func (s *StorageService) GetStreamURL(ctx context.Context, req *connect.Request[ // GetRendezvousNodes implements v1connect.StorageServiceHandler. func (s *StorageService) GetRendezvousNodes(ctx context.Context, req *connect.Request[v1.GetRendezvousNodesRequest]) (*connect.Response[v1.GetRendezvousNodesResponse], error) { + if s.mediorum == nil { + return nil, connect.NewError(connect.CodeUnavailable, errors.New("storage service not initialized")) + } cid := req.Msg.Cid if cid == "" { return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("cid is required")) @@ -215,6 +224,9 @@ func (s *StorageService) GetRendezvousNodes(ctx context.Context, req *connect.Re // GetIPData implements v1connect.StorageServiceHandler. func (s *StorageService) GetIPData(ctx context.Context, req *connect.Request[v1.GetIPDataRequest]) (*connect.Response[v1.GetIPDataResponse], error) { + if s.mediorum == nil { + return nil, connect.NewError(connect.CodeUnavailable, errors.New("storage service not initialized")) + } ip := req.Msg.Ip if ip == "" { return nil, connect.NewError(connect.CodeNotFound, errors.New("must send IP")) @@ -239,13 +251,12 @@ func (s *StorageService) GetIPData(ctx context.Context, req *connect.Request[v1. // GetStatus implements v1connect.StorageServiceHandler. func (s *StorageService) GetStatus(context.Context, *connect.Request[v1.GetStatusRequest]) (*connect.Response[v1.GetStatusResponse], error) { - if s.mediorum == nil { - return connect.NewResponse(&v1.GetStatusResponse{ - StorageExpectation: 0, - }), nil + storageExpectation := int64(0) + if s.mediorum != nil { + storageExpectation = int64(s.mediorum.storageExpectation) } return connect.NewResponse(&v1.GetStatusResponse{ - StorageExpectation: int64(s.mediorum.storageExpectation), + StorageExpectation: storageExpectation, }), nil } From 3d1a58f0b31f041d9c88b4f25d4784ad6947b401 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 9 Feb 2026 14:29:25 -0800 Subject: [PATCH 3/5] Fix titles --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fcb74372..e330dd05 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > A golang implementation of the OpenAudio protocol. -# Quickstart +## Quickstart ```bash docker run --rm -it \ @@ -15,6 +15,7 @@ docker run --rm -it \ -e OPENAUDIO_STORAGE_ENABLED=false \ openaudio/go-openaudio:stable +# in another terminal session open https://localhost/console/overview ``` @@ -22,9 +23,9 @@ open https://localhost/console/overview To run a validator and secure the network, visit [docs.openaudio.org](https://docs.openaudio.org/tutorials/run-a-node). -# Local Development +## Local Development -## Prerequisites +### Prerequisites Ensure the following are installed: @@ -38,11 +39,11 @@ The remaining dependencies can then be automatically installed with `make`: make install-deps ``` -## Running local devnet +### Running local devnet You can simulate an openaudio network by running multiple nodes on your machine. This makes developing certain features fast and easy. -### Setup +#### Setup Add the following hosts to your `/etc/hosts` file: @@ -56,7 +57,7 @@ Then add the local dev x509 cert to your keychain so you will have green ssl in sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dev/tls/cert.pem ``` -### Run +#### Run Build and run a local devnet with 4 nodes. @@ -108,7 +109,7 @@ open https://node1.oap.devnet/console/uptime > By default, hot reloading is only enabled on node1.oap.devnet to conserve system resources. > To enable on other nodes, update the corresponding env file in [dev/env](../dev/env). -## Develop against stage or prod +### Develop against stage or prod Build a local docker image @@ -122,7 +123,7 @@ Peer with mainnet docker run --rm -it -p 80:80 -p 443:443 -e NETWORK=prod openaudio/go-openaudio:dev ``` -## Run tests +### Run tests Run all tests From 7d0f8420aa75bdc3d345e8a1e8c7c6976888f30e Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 9 Feb 2026 18:01:46 -0800 Subject: [PATCH 4/5] Allow single test run --- .gitignore | 1 - .vscode/launch.json | 49 +++++++++++++++++++ .vscode/settings.json | 21 ++++++++ .../10_upload_stream_test.go | 5 +- pkg/integration_tests/utils/nodes.go | 31 ++++++++++-- 5 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 4f366aa0..f3a26ba6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .DS_Store -.vscode bin/* !bin/.gitkeep diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..949f5ad5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,49 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Test (Current File)", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${fileDirname}", + "args": [ + "-test.v", + "-test.run", + "^${selectedText}$" + ], + "cwd": "${workspaceFolder}", + "env": {}, + "showLog": true + }, + { + "name": "Debug Test (TestUploadStream)", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${workspaceFolder}/pkg/integration_tests", + "args": [ + "-test.v", + "-test.run", + "^TestUploadStream$" + ], + "cwd": "${workspaceFolder}", + "env": {}, + "showLog": true + }, + { + "name": "Debug All Integration Tests", + "type": "go", + "request": "launch", + "mode": "test", + "program": "${workspaceFolder}/pkg/integration_tests", + "args": [ + "-test.v", + "-test.timeout=90s" + ], + "cwd": "${workspaceFolder}", + "env": {}, + "showLog": true + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..d3c25136 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "go.testFlags": [ + "-v", + "-count=1", + "-timeout=90s" + ], + "go.testEnvVars": { + // These can be overridden by environment variables if needed + // The tests will use defaults from utils/nodes.go if not set + }, + "go.testTimeout": "90s", + // Enable test coverage if desired + "go.coverOnSave": false, + "go.coverOnTestPackage": false, + // Build tags if needed + "go.buildTags": "", + // Test output settings + "go.testOutputVerbose": true, + // Ensure tests run from the package directory (important for relative paths like ./assets/) + "go.testDir": "${workspaceFolder}" +} diff --git a/pkg/integration_tests/10_upload_stream_test.go b/pkg/integration_tests/10_upload_stream_test.go index 9b8466de..0c8f5125 100644 --- a/pkg/integration_tests/10_upload_stream_test.go +++ b/pkg/integration_tests/10_upload_stream_test.go @@ -15,7 +15,6 @@ import ( "github.com/OpenAudio/go-openaudio/pkg/common" "github.com/OpenAudio/go-openaudio/pkg/hashes" "github.com/OpenAudio/go-openaudio/pkg/integration_tests/utils" - "github.com/OpenAudio/go-openaudio/pkg/sdk" "github.com/OpenAudio/go-openaudio/pkg/sdk/mediorum" "github.com/google/uuid" "github.com/stretchr/testify/require" @@ -32,7 +31,7 @@ func TestUploadStream(t *testing.T) { privKeyPath := "./assets/demo_key.txt" privKeyPath2 := "./assets/demo_key2.txt" - oap := sdk.NewOpenAudioSDK(serverAddr) + oap := utils.NewTestSDK(serverAddr) if err := oap.ReadPrivKey(privKeyPath); err != nil { require.Nil(t, err, "failed to read private key: %w", err) } @@ -337,7 +336,7 @@ func TestUploadStream(t *testing.T) { // Test that non-owner cannot get stream URLs t.Log("\n=== Testing access control ===") - sdk2 := sdk.NewOpenAudioSDK(serverAddr) + sdk2 := utils.NewTestSDK(serverAddr) if err := sdk2.ReadPrivKey(privKeyPath2); err != nil { require.Nil(t, err, "failed to read private key: %w", err) } diff --git a/pkg/integration_tests/utils/nodes.go b/pkg/integration_tests/utils/nodes.go index fa5535ba..8c78a961 100644 --- a/pkg/integration_tests/utils/nodes.go +++ b/pkg/integration_tests/utils/nodes.go @@ -2,7 +2,9 @@ package utils import ( "context" + "crypto/tls" "errors" + "net/http" "os" "strings" "time" @@ -24,11 +26,32 @@ var ( ContentThree *sdk.OpenAudioSDK ) +// NewTestHTTPClient creates an HTTP client configured for local devnet testing. +// It skips TLS verification to work with self-signed certificates while maintaining HTTPS protocol. +func NewTestHTTPClient() *http.Client { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + return &http.Client{ + Transport: tr, + Timeout: 30 * time.Second, + } +} + +// NewTestSDK creates a new SDK instance with the test HTTP client. +// Use this when you need to create SDK instances in tests instead of using the pre-configured ones. +func NewTestSDK(nodeURL string) *sdk.OpenAudioSDK { + return sdk.NewOpenAudioSDKWithClient(nodeURL, NewTestHTTPClient()) +} + func init() { - DiscoveryOne = sdk.NewOpenAudioSDK(DiscoveryOneRPC) - ContentOne = sdk.NewOpenAudioSDK(ContentOneRPC) - ContentTwo = sdk.NewOpenAudioSDK(ContentTwoRPC) - ContentThree = sdk.NewOpenAudioSDK(ContentThreeRPC) + // Use custom HTTP client that skips TLS verification for self-signed certs in devnet + // This maintains HTTPS protocol (as expected by the server) but allows local testing + httpClient := NewTestHTTPClient() + DiscoveryOne = sdk.NewOpenAudioSDKWithClient(DiscoveryOneRPC, httpClient) + ContentOne = sdk.NewOpenAudioSDKWithClient(ContentOneRPC, httpClient) + ContentTwo = sdk.NewOpenAudioSDKWithClient(ContentTwoRPC, httpClient) + ContentThree = sdk.NewOpenAudioSDKWithClient(ContentThreeRPC, httpClient) } func getEnvWithDefault(key, defaultValue string) string { From d384512eac5c08ccec187c8f3809c1ff798ff101 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 9 Feb 2026 18:13:57 -0800 Subject: [PATCH 5/5] Update badges --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e330dd05..b67a7df8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# OpenAudio Protocol +# Open Audio Protocol -[![license](https://img.shields.io/github/license/OpenAudio/go-openaudio)](https://github.com/OpenAudio/go-openaudio/blob/main/LICENSE) [![releases](https://img.shields.io/github/v/release/OpenAudio/go-openaudio)](https://github.com/OpenAudio/go-openaudio/releases/latest) +[![license](https://img.shields.io/github/license/OpenAudio/go-openaudio?style=for-the-badge)](https://github.com/OpenAudio/go-openaudio/blob/main/LICENSE) [![Docs](https://img.shields.io/badge/docs-openaudio.org-lightgrey?style=for-the-badge)](https://docs.openaudio.org) [![releases](https://img.shields.io/github/v/release/OpenAudio/go-openaudio?style=for-the-badge)](https://github.com/OpenAudio/go-openaudio/releases/latest) [![Dockerhub](https://img.shields.io/docker/v/openaudio/go-openaudio?sort=semver&style=for-the-badge&label=Docker)](https://hub.docker.com/r/openaudio/go-openaudio) -> A golang implementation of the OpenAudio protocol. + + +> A golang implementation of the Open Audio Protocol. ## Quickstart