I have made a start

I have done some work on opening a socket and waiting for a connection.
This can be read line by line and I have started a request struct that
it will accept.

Also started on some docs. Not much is yet working. I am going to start
learning µnit for unit tests:

https://nemequ.github.io/munit/
This commit is contained in:
Jonathan Hodgson 2021-12-27 21:43:11 +00:00
parent 4e17e706fa
commit f48a110429
15 changed files with 599 additions and 1 deletions

79
docs/config.md Normal file
View file

@ -0,0 +1,79 @@
# Config
There will be 2 config files available. One at
$XDG_CONFIG_HOME/yaip/proxy.conf and one at proxy.conf in the directory that the
tool is run from. Either can be overwritten with command line flags.
The config file is (currently), very simple. Empty lines are ignored, as are
lines that start with a # symbol. This is useful if you wish to make comments
about configuration choices.
The file in $XDG_CONFIG_HOME is parsed first, followed by the file in the
current working directory meaning that the config file in the current directory
will take precedence.
To set a configuration option, the line should have the configuration option
followed by a colon, an optional space and the value it should be set to.
For example:
```
port: 8080
```
All options may also be set via a command line switch -c or --config followed by the name
and the value.
For example:
```
yaip --config port 8080
```
## Available Options
### port
The listening port.
Default:
```
port: 8080
```
### database
The database that requests and responses should be stored in.
Default:
```
database: proxy.sqlite
```
### localConfig
The name of the local config file:
Default:
```
localConfig: proxy.conf
```
### userConfig
The name of the user config file:
Default:
```
$XDG_CONFIG_HOME/yaip/proxy.conf
```
**Note:** It only makes sense to change this as a command line argument as it is
the first config file that is sourced.

28
docs/plugins.md Normal file
View file

@ -0,0 +1,28 @@
# Plugins
**Note:** This is not implemented yet - it is mearly my plan.
The tool should be able to load plugins. These should be stand alone scripts /
executables that YAIP can call using `system()` or similar.
I will use a hook / filter type system. There will be different things that
plugins can do. The order in which plugins run will be dictated in the config
file or via an API if already running. The API still needs to be thought out.
## Intercept Plugins
Plugins will be able to intercept requests / responses. This will be blocking.
I haven't decided yet if these plugins will run on stdin or a temporary file.
I would prefer stdin / stdout although I think that would make it difficult for
a plugin to launch vim and have it be interactive. I'll have to do some trial
and error.
## Analysis Plugins
These plugins will hopefully be able to run asynchronously without intercepting
requests / responses. The idea for this is that the plugins could check for
misconfigured headers or sql statements or whatever. These won't be able to
change what the server / browser receives.