-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add config file loading (#194)
- Loading branch information
Showing
36 changed files
with
2,455 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
|
||
"github.com/haveachin/infrared/configs" | ||
) | ||
|
||
func createConfigIfNotExist() error { | ||
info, err := os.Stat(configPath) | ||
if errors.Is(err, os.ErrNotExist) { | ||
if err := os.Mkdir(proxiesDir, 0755); err != nil { | ||
return err | ||
} | ||
|
||
return createDefaultConfigFile() | ||
} | ||
|
||
if info.IsDir() { | ||
return errors.New("ir.Config is a directory") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func createDefaultConfigFile() error { | ||
bb := configs.DefaultInfraredConfig | ||
return os.WriteFile(configPath, bb, 0664) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Infrared Config | ||
|
||
# Address that Infrared bind and listens to | ||
# | ||
bind: 0.0.0.0:25565 | ||
|
||
proxyProtocol: | ||
# Receive proxy protocol | ||
# | ||
#receive: true | ||
|
||
# TODO | ||
# | ||
#trustedProxies: | ||
# - "127.0.0.1" | ||
|
||
# Maximum duration between packets before the client gets timed out. | ||
# | ||
keepAliveTimeout: 30s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package configs | ||
|
||
import _ "embed" | ||
|
||
//go:embed config.yml | ||
var DefaultInfraredConfig []byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This is the domain that players enter in their game client. | ||
# You can have multiple domains here or just one. | ||
# Currently this holds just a wildcard character as a domain | ||
# meaning that is accepts every domain that a player uses. | ||
# Supports '*' and '?' wildcards in the pattern string. | ||
# | ||
domains: | ||
- "*" | ||
|
||
addresses: | ||
- example.com:25565 | ||
|
||
# Send a Proxy Protocol v2 Header to the server to | ||
# forward the players IP address | ||
# | ||
#sendProxyProtocol: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { defineConfig} from 'vitepress' | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
lang: 'en-US', | ||
title: 'Infrared', | ||
titleTemplate: ':title | Minecraft Proxy', | ||
description: 'Minecraft Proxy', | ||
cleanUrls: true, | ||
head: [ | ||
[ | ||
'link', | ||
{ | ||
rel: 'icon', | ||
type: 'image/x-icon', | ||
href: '/assets/logo.svg', | ||
}, | ||
], | ||
], | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
logo: '/assets/logo.svg', | ||
|
||
nav: [ | ||
{ | ||
text: 'Guides', | ||
items: [ | ||
{ text: 'Forward Player IPs', link: '/guide/forward-player-ips' }, | ||
] | ||
}, | ||
{ | ||
text: 'Config', | ||
items: [ | ||
{ text: 'Global', link: '/config/' }, | ||
{ text: 'Proxy', link: '/config/proxy' }, | ||
{ text: 'CLI & Env Vars', link: '/config/cli-and-env-vars' }, | ||
] | ||
}, | ||
{ | ||
text: 'Donate', | ||
items: [ | ||
{ text: 'PayPal', link: 'https://paypal.me/hendrikschlehlein' }, | ||
{ text: 'Ko-Fi', link: 'https://ko-fi.com/haveachin' }, | ||
] | ||
}, | ||
], | ||
|
||
sidebar: [ | ||
{ text: 'Getting Started', link: '/getting-started' }, | ||
{ | ||
text: 'Config', | ||
items: [ | ||
{ text: 'Global', link: '/config/' }, | ||
{ text: 'Proxies', link: '/config/proxies' }, | ||
{ text: 'CLI & Env Vars', link: '/config/cli-and-env-vars' }, | ||
], | ||
}, | ||
{ | ||
text: 'Guides', | ||
items: [ | ||
{ text: 'Forward Player IPs', link: '/guide/forward-player-ips' }, | ||
] | ||
}, | ||
{ text: 'Report an Issue', link: 'https://github.com/haveachin/infrared/issues' }, | ||
{ text: 'Ask in Discussions', link: 'https://github.com/haveachin/infrared/discussions' }, | ||
{ text: 'Join our Discord', link: 'https://discord.gg/r98YPRsZAx' }, | ||
{ text: 'Branding', link: '/branding' }, | ||
], | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/haveachin/infrared' }, | ||
{ icon: 'discord', link: 'https://discord.gg/r98YPRsZAx' }, | ||
], | ||
|
||
footer: { | ||
message: 'Released under the <a href="https://www.gnu.org/licenses/agpl-3.0.en.html">AGPL-3.0</a>.', | ||
copyright: 'Copyright © 2019-present Haveachin and Contributors', | ||
}, | ||
|
||
editLink: { | ||
pattern: 'https://github.com/haveachin/infrared/edit/master/website/:path' | ||
}, | ||
|
||
search: { | ||
provider: 'local' | ||
}, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* .vitepress/theme/custom.css */ | ||
:root { | ||
--vp-c-brand-1: #CC0033; | ||
--vp-c-brand-2: #B7002D; | ||
--vp-c-brand-3: #A30028; | ||
--vp-c-brand-light: #b3002d; | ||
--vp-c-brand-lighter: #990026; | ||
--vp-c-brand-dark: #e60039; | ||
--vp-c-brand-darker: #ff0040; | ||
|
||
--vp-home-hero-name-color: transparent; | ||
--vp-home-hero-name-background: linear-gradient( | ||
180deg, | ||
#CC0033ff, | ||
#CC0033B0 | ||
); | ||
|
||
--vp-home-hero-image-filter: blur(40px); | ||
--vp-home-hero-image-background-image: linear-gradient( | ||
120deg, | ||
#CC003325, | ||
#CC003315 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// .vitepress/theme/index.js | ||
import DefaultTheme from 'vitepress/theme' | ||
import './custom.css' | ||
|
||
export default DefaultTheme |
File renamed without changes
File renamed without changes
Oops, something went wrong.