Skip to content

Configure

If you do not have a config file yet, get the default config, including an ID, with:

mycoria config generate # Auto-detect country using reallyfreegeoip.org.
# or
mycoria config generate XX # Replace XX with your country code. (US needs state: eg. US-DC)

Why does Mycoria need my country code?

It's a vital part of the scalable routing concept.
Read more about it here.

If you pick an incorrect one, it will undermine your routing performance.

Currently, there is just one simple yaml file that holds all configuration.
Here is an example with explanations:

router:
  # Identity of the router.
  # Important: This contains the _private_ key of the router.
  # Keep secret. Do not share.
  # This is generated by "mycoria config generate XX" and must not be changed.
  address:
    ip: fd1f:2cf7:903:b50b:e4cb:5c4c:270e:360c
    hash: BLAKE3
    type: Ed25519
    public: 8919290ac6c7e815...
    private: 505f0dc9473cd22e...

  # Define the "universe" the router is in.
  # Routers can only connect to other routers within the same universe.
  # You can use this to easily create own siloed Mycoria network.
  universe: test

  # Set a secret that every router in your universe must know to connect.
  # In case you want to stay alone.
  # While the universe name is shared in plain-text,
  # the universe secret itself never leaves the router.
  universeSecret: correct horse battery stable

  # By default, Mycoria allows local traffic to any IP.
  # If you distrust content hosted within Mycoria, you can enable isolation.
  # If isolated, the router will only allow local traffic that goes friends.
  # The router will still help others in the network to route their traffic.
  isolate: true

  # Advertise how this router is reachable through IANA assigned IPs and names.
  iana:
  - "0.1.2.3"
  - "4.5.6.7"
  - example.com

  # Define to which routers this router should
  # always try to hold a connection to.
  connect:
  - "tcp://8.9.10.11"
  - "tcp://example.org"

  # Define on which ports (and protocols) the router listens.
  # Currently on tcp is supported, more will come. (WIP)
  listen:
  - tcp:47369

  # Enable the router to choose automatically to which other
  # routers it connects. Routers will optimize their connections
  # based on measurements and estimated location.
  autoConnect: true

    # Specify the minimum amount of connections that the router
    # should automatically connect to in order to improve network flow.
    # Enables autoConnect if defined.
    # Minimum is 1, Defaults to 2.
    minAutoConnect: 5

  # If no other routers with public IANA IPs are known,
  # connect to one of these to bootstrap.
  bootstrap:
  - tcp://bootstrap.mycoria.org:47369

  # Runs the router in stub mode. It will not relay router announcements
  # and will appear as a dead end to other routers.
  stub: true

  # Runs the router in lite mode. It will attempt to reduce any non-essential
  # activity and traffic.
  # Behavior will slightly change over time and also depends on other routers
  # playing along - do not use for workarounds.
  # Other routers will not send route announcements to lite routers, except if
  # they are lite routers themselves. This way, a group of lite routers can
  # live without the full routing table, but can't use source routing.
  lite: true

system:
  # Define the name of the tun interface.
  tunName: Mycoria

  # Set a custom MTU for the tun interface.
  # Values not accepted by your OS will prevent Mycoria from starting.
  tunMTU: 9000

  # Disables the TUN device, cutting of Mycoria from the network of the device.
  # Useful for relay only routers.
  disableTUN: true

  # Set a custom IP and port for the API to listen on.
  # By default it listens on the internal Mycoria IP fd00::b909.
  apiListen: "127.0.0.1:80"

  # Define where and how to store the router state.
  # Must end with one of:
  # .json
  # .sqlite - coming soon (WIP)
  statePath: /home/user/.mycoria/state.json

  # Chromium has a mechanism that disables IPv6 DNS queries if no IPv6
  # connectivity is detected. This prevents any Chromium-based browser from
  # sending IPv6 DNS queries to Mycoria for DNS resolution.
  # Mycoria uses the same check for IPv6 connectivity, and will add a fake
  # route to 2001:4860:4860::8888/128 in order to get Chromium to send IPv6 DNS
  # queries.
  # You can disable that behavior with this flag. 
  disableChromiumWorkaround: true

# By default, no incoming traffic from Mycoria
# to your device is allowed by the router.
# You will need to define the services you want to allow here.
services:

# This is a public service, any other Mycoria router can access it.
# This service allows pinging and is added by default.
- name: ping
  url: 'icmp6:'
  public: true

# You can also announce services for simple service discovery.
- name: Project Status
  description: Website that shows the status of my project.
  url: 'http://my-project.myco/'
  public: true
  advertise: true

# You can also allow services only for friends or a custom list of routers.
- name: Secret Portal
  url: 'tcp://:81'
  # Allow all friends.
  friends: true
  # Allow a list of router IPs or friend names.
  for:
  - fd1f:14ed:bc18:ecb1:af00:9a2d:2a76:201d
  - alice

# Choose your friends wisely.
# Friends are used for simplified access control.
# You can only allow connections to friends with "isolate=true"
# You can only allow connections from friends to a service with "friends=true"
# If you have setup your DNS for Mycoria, you can also resolve their names.
friends:
- name: alice # Resolves as alice.myco.
  ip: fd1f:2cd5:6feb:7aa7:d674:1b3c:c82c:dfc
- name: bob # Resolves as bob.myco.
  ip: fd11:6e6d:b98a:538d:67e5:5244:8e98:9f6e

# You can also add any custom names for resolving.
# Be sure to point your DNS server at Mycoria for these records.
resolve:
  status.myco: fd00::b909