profile-proxy

module
v0.0.0-...-069755a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: Apache-2.0

README

Profile Proxy

Proxy JSON/YAML profiles and apply patches.

Configuration

Reads ${cwd}/config.json.

{
    "listen_addr": "0.0.0.0:8080",
    "profiles": [
        {
            "tag": "profile-json",
            "format": "json",
            "url": "http://foo.bar/path/to/profile.json",
            "ua": "User Agent",
            "patches": [
                "patch1"
            ]
        },
        {
            "tag": "profile-yaml",
            "format": "yaml",
            "url": "http://foo.bar/path/to/profile.yaml",
            "ua": "User Agent",
            "patches": [
                "patch1",
                "patch2"
            ]
        }
    ],
    "patches": [
        {
            "tag": "patch1",
            "content": {
                "+foo": [
                    "bar1",
                    "bar2"
                ]
            }
        },
        {
            "tag": "patch2",
            "content": {
                "114!": [
                    "514",
                    "1919"
                ]
            }
        }
    ]
}

Get profile at http://<listen_addr>/profile/<profile-tag>.

Patch syntax

Object in content will be applyed on the original profile with the following rules:

Default

Default action is deep merge. Simple types are overwritten.

Modifiers

Add modifiers to keys to specify merge behavior.

Override
Modifier Type Description
! suffix Force overwrite

Example:

# Original
foo:
  bar1: 1
  bar2: 2

# Patch
foo!:
- bar1
- bar2

# Result
foo:
- bar1
- bar2
Arrays
Modifier Type Description
+ prefix Prepend array
+ suffix Append array

Example:

# Original
foo:
- bar1
- bar2

# Patch
+foo:
- bar3
- bar4

# Result
foo:
- bar3
- bar4
- bar1
- bar2
# Original
foo:
- bar1
- bar2

# Patch
foo+:
- bar3
- bar4

# Result
foo:
- bar1
- bar2
- bar3
- bar4
Escape

Wrap keys that start or end with a modifier in brackets (<>).

Example:

# Original
foo+:
  bar1: 1
  bar2: 2

# Patch
<foo+>!:
- bar1
- bar2

# Result
foo+:
- bar1
- bar2

License

Copyright 2026 HT4w5

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
cmd
pp command
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL