pacutil

package
v0.0.0-...-9c55465 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 16 Imported by: 0

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"},
}

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