pacutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PacServe = &gcli.Command{
		Name: "serve",
		Desc: "start an pac serve",
		Func: func(c *gcli.Command, args []string) error {
			return startServer(pacOpts)
		},

		Config: func(c *gcli.Command) {
			c.StrOpt(&pacOpts.addr, "addr", "a", ":11080", "server address")
			c.StrOpt(&pacOpts.file, "file", "f", "", "pac file path")
			c.Opt("file").Required = true

			c.StrOpt(&pacOpts.gwfile, "gwfile", "", "", "gfw list file")
			c.StrOpt(&pacOpts.maxAge, "max-age", "m", "31536000", "Cache Control max-age")
		},
		Examples: `
{$fullCmd} -f ./tmp/gfwlist-210422.pac
`,
	}

	GFWListUpdate = &gcli.Command{
		Name: "gwup",
		Desc: "start an pac serve",
		Func: func(c *gcli.Command, args []string) error {
			return nil
		},

		Aliases: []string{"upgw"},
	}

	// example: pacgo catgw -f tmp/gfwlist-210422.txt
	GFWListCat = &gcli.Command{
		Name: "catgw",
		Desc: "decode gfw list content and print it",
		Func: func(c *gcli.Command, args []string) error {
			dst, err := DecodeGfwList(pacOpts.gwfile)
			if err != nil {
				return err
			}

			fmt.Println(string(dst))
			return nil
		},

		Aliases: []string{"catgw"},
		Config: func(c *gcli.Command) {
			c.StrOpt(&pacOpts.gwfile, "file", "f", "", "gfw list file")
			c.StrOpt(&pacOpts.gwUrl, "url", "u", "", "gfw list file url")
		},
		Examples: `
{$fullCmd} -f ./tmp/gfwlist-210422.txt
`,
	}

	GFWList2pac = &gcli.Command{
		Name: "gwconv",
		Desc: "convert gfw list to an pac file",
		Func: func(c *gcli.Command, args []string) error {
			return nil
		},

		Aliases: []string{"convgw"},
	}
)
View Source
var PacTools = &gcli.Command{
	Name: "pacgo",

	Desc: "pac tools",
	Subs: []*gcli.Command{
		PacServe,
		GFWListCat,
		GFWList2pac,
		GFWListUpdate,
	},

	Aliases: []string{"pac"},
}

PacTools refer links https://github.com/100apps/ipac https://zh.wikipedia.org/zh/%E4%BB%A3%E7%90%86%E8%87%AA%E5%8A%A8%E9%85%8D%E7%BD%AE

Functions

func DecodeGfwList

func DecodeGfwList(gwfile string) (dst []byte, err error)

Types

type HandlerGroup

type HandlerGroup struct {
	// contains filtered or unexported fields
}

refer https://github.com/ceaser/pac-server/blob/master/main.go

type PData

type PData struct {
	Body    []byte
	Message string
	Etag    string
	MaxAge  string
	// contains filtered or unexported fields
}

type PacOpts

type PacOpts struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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