winproxy

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 2 Imported by: 0

README

winproxy

Change Windows system proxy settings

license build workflow go report card

English简体中文

Usage

winproxy provides two ways to change the proxy settings of a Windows system: through the command line or through code.

Command line

You can install winproxy using the go install command or by downloading and installing it manually.

go install github.com/fhluo/winproxy/cmd/winproxy@latest
  • Use the winproxy command to display the current proxy settings.
  • Use the winproxy help command to view the help.
Code
package main

import (
	"github.com/fhluo/winproxy"
	"log"
)

func main() {
	// Read the current proxy settings
	settings, err := winproxy.ReadSettings()
	if err != nil {
		log.Fatalln(err)
	}

	// Change the proxy settings
	settings.Proxy = true
	settings.ProxyAddress = "127.0.0.1:8080"
	settings.Script = false
	settings.ScriptAddress = ""
	settings.AutoDetect = false
	settings.BypassList = []string{
		"<local>",
	}

	// Apply the proxy settings
	if err = settings.Apply(); err != nil {
		log.Fatalln(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	Proxy        bool
	ProxyAddress string

	Script        bool
	ScriptAddress string

	AutoDetect bool

	BypassList []string
	// contains filtered or unexported fields
}

func ReadSettings

func ReadSettings() (s Settings, err error)

ReadSettings reads the settings from the registry.

func (Settings) Apply added in v0.2.0

func (s Settings) Apply() error

Apply writes the settings to the registry.

Directories

Path Synopsis
cmd
Package settings provides the ability to read, write, decode and encode the binary data of DefaultConnectionSettings from the Windows registry.
Package settings provides the ability to read, write, decode and encode the binary data of DefaultConnectionSettings from the Windows registry.

Jump to

Keyboard shortcuts

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