mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Use Go1.11 module (#5743)
* Migrate to go modules * make vendor * Update mvdan.cc/xurls * make vendor * Update code.gitea.io/git * make fmt-check * Update github.com/go-sql-driver/mysql * make vendor
This commit is contained in:
		
							
								
								
									
										1
									
								
								vendor/github.com/kevinburke/ssh_config/.gitattributes
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/kevinburke/ssh_config/.gitattributes
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
testdata/dos-lines eol=crlf
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/kevinburke/ssh_config/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/kevinburke/ssh_config/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
/bazel-*
 | 
			
		||||
							
								
								
									
										15
									
								
								vendor/github.com/kevinburke/ssh_config/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/kevinburke/ssh_config/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
go_import_path: github.com/kevinburke/ssh_config
 | 
			
		||||
 | 
			
		||||
language: go
 | 
			
		||||
 | 
			
		||||
go:
 | 
			
		||||
  - 1.9.x
 | 
			
		||||
  - 1.10.x
 | 
			
		||||
  - 1.11.x
 | 
			
		||||
  - master
 | 
			
		||||
 | 
			
		||||
before_script:
 | 
			
		||||
    - go get -u ./...
 | 
			
		||||
 | 
			
		||||
script:
 | 
			
		||||
    - make race-test
 | 
			
		||||
							
								
								
									
										32
									
								
								vendor/github.com/kevinburke/ssh_config/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								vendor/github.com/kevinburke/ssh_config/Makefile
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
BUMP_VERSION := $(GOPATH)/bin/bump_version
 | 
			
		||||
MEGACHECK := $(GOPATH)/bin/megacheck
 | 
			
		||||
WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap
 | 
			
		||||
 | 
			
		||||
IGNORES := 'github.com/kevinburke/ssh_config/config.go:U1000 github.com/kevinburke/ssh_config/config.go:S1002 github.com/kevinburke/ssh_config/token.go:U1000'
 | 
			
		||||
 | 
			
		||||
$(MEGACHECK):
 | 
			
		||||
	go get honnef.co/go/tools/cmd/megacheck
 | 
			
		||||
 | 
			
		||||
lint: $(MEGACHECK)
 | 
			
		||||
	go vet ./...
 | 
			
		||||
	$(MEGACHECK) --ignore=$(IGNORES) ./...
 | 
			
		||||
 | 
			
		||||
test: lint
 | 
			
		||||
	@# the timeout helps guard against infinite recursion
 | 
			
		||||
	go test -timeout=250ms ./...
 | 
			
		||||
 | 
			
		||||
race-test: lint
 | 
			
		||||
	go test -timeout=500ms -race ./...
 | 
			
		||||
 | 
			
		||||
$(BUMP_VERSION):
 | 
			
		||||
	go get -u github.com/kevinburke/bump_version
 | 
			
		||||
 | 
			
		||||
release: test | $(BUMP_VERSION)
 | 
			
		||||
	$(BUMP_VERSION) minor config.go
 | 
			
		||||
 | 
			
		||||
force: ;
 | 
			
		||||
 | 
			
		||||
AUTHORS.txt: force | $(WRITE_MAILMAP)
 | 
			
		||||
	$(WRITE_MAILMAP) > AUTHORS.txt
 | 
			
		||||
 | 
			
		||||
authors: AUTHORS.txt
 | 
			
		||||
							
								
								
									
										81
									
								
								vendor/github.com/kevinburke/ssh_config/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								vendor/github.com/kevinburke/ssh_config/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,81 @@
 | 
			
		||||
# ssh_config
 | 
			
		||||
 | 
			
		||||
This is a Go parser for `ssh_config` files. Importantly, this parser attempts
 | 
			
		||||
to preserve comments in a given file, so you can manipulate a `ssh_config` file
 | 
			
		||||
from a program, if your heart desires.
 | 
			
		||||
 | 
			
		||||
It's designed to be used with the excellent
 | 
			
		||||
[x/crypto/ssh](https://golang.org/x/crypto/ssh) package, which handles SSH
 | 
			
		||||
negotiation but isn't very easy to configure.
 | 
			
		||||
 | 
			
		||||
The `ssh_config` `Get()` and `GetStrict()` functions will attempt to read values
 | 
			
		||||
from `$HOME/.ssh/config` and fall back to `/etc/ssh/ssh_config`. The first
 | 
			
		||||
argument is the host name to match on, and the second argument is the key you
 | 
			
		||||
want to retrieve.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
port := ssh_config.Get("myhost", "Port")
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You can also load a config file and read values from it.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
var config = `
 | 
			
		||||
Host *.test
 | 
			
		||||
  Compression yes
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
cfg, err := ssh_config.Decode(strings.NewReader(config))
 | 
			
		||||
fmt.Println(cfg.Get("example.test", "Port"))
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Some SSH arguments have default values - for example, the default value for
 | 
			
		||||
`KeyboardAuthentication` is `"yes"`. If you call Get(), and no value for the
 | 
			
		||||
given Host/keyword pair exists in the config, we'll return a default for the
 | 
			
		||||
keyword if one exists.
 | 
			
		||||
 | 
			
		||||
### Manipulating SSH config files
 | 
			
		||||
 | 
			
		||||
Here's how you can manipulate an SSH config file, and then write it back to
 | 
			
		||||
disk.
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
 | 
			
		||||
cfg, _ := ssh_config.Decode(f)
 | 
			
		||||
for _, host := range cfg.Hosts {
 | 
			
		||||
    fmt.Println("patterns:", host.Patterns)
 | 
			
		||||
    for _, node := range host.Nodes {
 | 
			
		||||
        // Manipulate the nodes as you see fit, or use a type switch to
 | 
			
		||||
        // distinguish between Empty, KV, and Include nodes.
 | 
			
		||||
        fmt.Println(node.String())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Print the config to stdout:
 | 
			
		||||
fmt.Println(cfg.String())
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Spec compliance
 | 
			
		||||
 | 
			
		||||
Wherever possible we try to implement the specification as documented in
 | 
			
		||||
the `ssh_config` manpage. Unimplemented features should be present in the
 | 
			
		||||
[issues][issues] list.
 | 
			
		||||
 | 
			
		||||
Notably, the `Match` directive is currently unsupported.
 | 
			
		||||
 | 
			
		||||
[issues]: https://github.com/kevinburke/ssh_config/issues
 | 
			
		||||
 | 
			
		||||
## Errata
 | 
			
		||||
 | 
			
		||||
This is the second [comment-preserving configuration parser][blog] I've written, after
 | 
			
		||||
[an /etc/hosts parser][hostsfile]. Eventually, I will write one for every Linux
 | 
			
		||||
file format.
 | 
			
		||||
 | 
			
		||||
[blog]: https://kev.inburke.com/kevin/more-comment-preserving-configuration-parsers/
 | 
			
		||||
[hostsfile]: https://github.com/kevinburke/hostsfile
 | 
			
		||||
 | 
			
		||||
## Donating
 | 
			
		||||
 | 
			
		||||
Donations free up time to make improvements to the library, and respond to
 | 
			
		||||
bug reports. You can send donations via Paypal's "Send Money" feature to
 | 
			
		||||
kev@inburke.com. Donations are not tax deductible in the USA.
 | 
			
		||||
		Reference in New Issue
	
	Block a user