# Default Relay Server Addresses for croc: IPv4, IPv6, and Configuration Guide

> Discover default croc relay server addresses for IPv4 and IPv6. Learn how croc uses croc.schollz.com and croc6.schollz.com and how to configure them.

- Repository: [Zack/croc](https://github.com/schollz/croc)
- Tags: how-to-guide
- Published: 2026-07-26

---

**croc uses `croc.schollz.com:9009` for IPv4 and `croc6.schollz.com:9009` for IPv6 as its default relay server addresses, resolving these hostnames to concrete IP addresses during program initialization unless overridden by command-line flags.**

When you send files using croc without specifying a custom relay, the tool automatically connects to these built-in default relay server addresses for croc. These hostnames are defined as constants in the source code and provide the public relay infrastructure maintained by the project maintainers. Understanding these defaults is essential for users who need to troubleshoot connectivity issues or deploy private relay servers behind firewalls.

## Built-in Default Relay Hostnames

According to the `schollz/croc` source code, the default relay addresses are hardcoded in [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) at lines 20 and 21.

### IPv4 Default Relay

The **IPv4 default relay** is defined by the constant `DEFAULT_RELAY` as `croc.schollz.com`. During program startup, the `init()` function resolves this hostname to a concrete IP address and appends port `9009`, forming the full address string used for TCP connections.

### IPv6 Default Relay

The **IPv6 default relay** is defined by the constant `DEFAULT_RELAY6` as `croc6.schollz.com`. Like its IPv4 counterpart, this address undergoes DNS resolution at runtime to determine the specific IP address before the relay connection is established.

## Runtime Address Resolution

The croc binary does not simply use DNS hostnames for connections. Instead, the `init()` function in [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) (around lines 86–100) calls a `lookup()` function to resolve both `DEFAULT_RELAY` and `DEFAULT_RELAY6` to specific IP addresses immediately upon program startup.

This resolution process uses either the system DNS resolver or a list of public DNS servers. The resolved IP addresses, combined with the default port `9009`, are stored back into the `DEFAULT_RELAY` and `DEFAULT_RELAY6` variables, ensuring consistent connectivity throughout the file transfer session without repeated DNS lookups.

## Overriding Default Relays

You can override these default relay server addresses for croc using command-line flags without modifying the source code.

To specify a custom IPv4 relay:

```bash
croc send --relay myrelay.example.com file.txt

```

To specify a custom IPv6 relay:

```bash
croc send --relay6 myrelay6.example.com file.txt

```

When you provide these flags, croc skips the default hostname resolution and connects directly to your specified relay address, still defaulting to port `9009` unless configured otherwise in your relay setup.

## Inspecting Default Relays Programmatically

If you are building tools that integrate with croc, you can inspect the effective relay addresses at runtime by importing the models package:

```go
package main

import (
	"fmt"
	"github.com/schollz/croc/v10/src/models"
)

func main() {
	fmt.Printf("IPv4 relay: %s\n", models.DEFAULT_RELAY)
	fmt.Printf("IPv6 relay: %s\n", models.DEFAULT_RELAY6)
}

```

This outputs the fully resolved addresses (including port `9009`) that croc will use for connections when no custom relay is specified.

## Summary

- **IPv4 default relay:** `croc.schollz.com:9009` (defined in [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) line 20)
- **IPv6 default relay:** `croc6.schollz.com:9009` (defined in [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) line 21)
- **Resolution timing:** Hostnames are resolved to IP addresses during `init()` execution (lines 86–100) using the `lookup()` function
- **Override method:** Use `--relay` for IPv4 or `--relay6` for IPv6 command-line flags
- **Default port:** `9009` is automatically appended to resolved relay addresses

## Frequently Asked Questions

### What are the default relay server addresses for croc?

croc uses `croc.schollz.com:9009` for IPv4 traffic and `croc6.schollz.com:9009` for IPv6 traffic. These are stored in the `DEFAULT_RELAY` and `DEFAULT_RELAY6` constants within [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) and resolved to specific IP addresses when the program starts.

### Can I use croc without connecting to the default public relays?

Yes. You can deploy your own private relay server and specify it using the `--relay` flag for IPv4 or `--relay6` for IPv6. This completely bypasses the default `croc.schollz.com` infrastructure, which is useful for security-sensitive environments or offline networks.

### Why does croc resolve hostnames to IPs at startup instead of using DNS directly?

The `init()` function in [`src/models/constants.go`](https://github.com/schollz/croc/blob/main/src/models/constants.go) resolves hostnames to concrete IP addresses (lines 86–100) to ensure consistent connectivity throughout the transfer session. This approach handles DNS failures gracefully at startup rather than mid-transfer and allows the tool to verify connectivity before beginning file operations.

### What port does croc use for its default relay servers?

Both default relays use port `9009`, which is defined separately in the TCP defaults and appended to the resolved IP addresses during the initialization phase. If you run your own relay, you must ensure it listens on this port or specify an alternative port explicitly in your relay configuration.