[go-nuts] How to renderer the multiple html pages ?
Hi all: I make three html pages as index.html ,wps1.html and wps2.html. The three html pages are under the same folder. The expected flow is to login index.html first and access wps1 or wps2 by index page hyperlink. And then,I edit the golang source file and build exe file . But I launch the exe file and found I access the wps1 or wps2 and ocurred the error. So,How to renderer the multiple html pages ? Any one provide the sample solution ? Thanks so much. BR Robert -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] How to do for inserting input data(http request post method) into postgresql database
Hi all: I used net/http package to build up the http server with golang. Also,I make the simple Html page for front end . But I don't know how to do for inserting input data(http request post method) into postgresql database ? Any one could provide the sample code ? Thanks so much. BR Robert -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Stor file by ftp ,but show error as "553 Could not create file"
Hi all: I tried to Stor file by ftp ,but show error as "553 Could not create file". It is successful to use filezilla client,so ftp server is ok. Please give me some suggestions. Thanks so much. C:/Go/bin/go.exe build -i [F:/go/ftp_client] Success: process exited with code 0. F:/go/ftp_client/ftp_client.exe [F:/go/ftp_client] 553 Could not create file. Success: process exited with code 0. // ftp_client package main import ( "fmt" "os" "github.com/jlaffaye/ftp" ) func main() { c, err := ftp.Connect("192.168.44.129:21") if err != nil { fmt.Println(err) } err = c.Login("root", "74634265") if err != nil { fmt.Println(err) } //c.MakeDir("test") file, err := os.Open("F:/go/ftp_client/20161027-2.csv") if err != nil { fmt.Println(err) } defer file.Close() err = c.Stor("/root/", file) if err != nil { fmt.Println(err) } c.Quit() } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] File transfer,but file size is zero
HI Jesse McNelis: It works. Thanks so much for your great support. BR Robert 2017-02-07 18:12 GMT+08:00 Jesse McNelis <jes...@jessta.id.au>: > On Tue, Feb 7, 2017 at 9:01 PM, Robert Hsiung <xiong0...@gmail.com> wrote: > > Hi all: > > I tried to upload file via SFTP,but the file size is zero when it is > > done.Any suggestions? Thanks so much. > > // Copy the file > > > > dstFile.WriteTo(srcFile) > > > > } > > > > You're writing the empty destination file to the srcFile. > You probably want: > > n, err = dstFile.ReadFrom(srcFile) > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] ssh login failed
hi all: Thanks for your information. Good job. BR Robert 2017-02-07 18:17 GMT+08:00 Han-Wen Nienhuys <han...@google.com>: > The message > > ssh: handshake failed: ssh: unexpected message type 3 (expected one of > [6]) > > is from the spate of problems/fixes due to the recent rekeying rewrite. > > For the original message, it looks like the server hasn't enabled > keyboard-interactive, but it's hard to tell. Easiest is to set > debugHandshake = true and see what the log messages say. > > On Tue, Feb 7, 2017 at 4:15 AM, Brad Fitzpatrick <bradf...@golang.org> > wrote: > > Maybe Han-Wen, copied, knows. > > > > > > On Mon, Feb 6, 2017 at 7:00 PM, Robert Hsiung <xiong0...@gmail.com> > wrote: > >> > >> Hi Brad: > >> Thanks so much for your suggestion. I run "ssh -v" and get useful > >> information as attachment.So,I modify the code,but occurred the > different > >> problem as below. > >> ssh: handshake failed: ssh: unexpected message type 3 (expected one of > >> [6]) > >> > >> // ftp > >> > >> package main > >> > >> > >> > >> import ( > >> > >> "fmt" > >> > >> > >> > >> "github.com/pkg/sftp" > >> > >> "golang.org/x/crypto/ssh" > >> > >> ) > >> > >> > >> > >> func main() { > >> > >> c := { > >> > >> User: "root", > >> > >> Auth: []ssh.AuthMethod{ > >> > >> ssh.Password("12345678"), > >> > >> }, > >> > >> } > >> > >> connection, err := ssh.Dial("tcp", "192.168.44.129:22", c) // > replace > >> this > >> > >> if err != nil { > >> > >> fmt.Println(err) > >> > >> return > >> > >> } > >> > >> > >> > >> server, err := sftp.NewClient(connection) > >> > >> if err != nil { > >> > >> fmt.Println(err) > >> > >> return > >> > >> } > >> > >> > >> > >> dir, err := server.ReadDir(".") > >> > >> if err != nil { > >> > >> fmt.Println(err) > >> > >> return > >> > >> } > >> > >> for _, fi := range dir { > >> > >> fmt.Println(fi.Name()) > >> > >> } > >> > >> } > >> > >> > >> 2017-02-07 0:55 GMT+08:00 Brad Fitzpatrick <bradf...@golang.org>: > >>> > >>> From looking at: > >>> > >>> ssh: unable to authenticate, attempted methods [none], no supported > >>> methods remain > >>> > >>> It seems like your ssh server requires a different authentication mode > >>> and doesn't support KeyboardInteractive (a password). > >>> > >>> Does the standard ssh client work? What does "ssh -v" say? > >>> > >>> > >>> On Mon, Feb 6, 2017 at 1:25 AM, Robert Hsiung <xiong0...@gmail.com> > >>> wrote: > >>>> > >>>> Dear all: > >>>> I tried to test sftp function with below coding,but occurred problem > as > >>>> below. Please give me suggestions. Thanks so much. > >>>> ssh: handshake failed: ssh: unable to authenticate, attempted methods > >>>> [none], no supported methods remain > >>>> > >>>> >>>> > >>>> package main > >>>> > >>>> import ( > >>>> "fmt" > >>>> "github.com/pkg/sftp" > >>>> "golang.org/x/crypto/ssh" > >>>> ) > >>>> > >>>> func main() { > >>>> > >>>> c := { > >>>> User: "root", // replace this > >>>> Auth: []ssh.AuthMethod{ > >>>> ssh.KeyboardInteractive(func(user, instruction string, questions > >>>> []string, echos []bool) ([]string, error) { > >>>> // Just send the password back for all questions > >>>> answers := make([]string, len(questions)) > >>>> for i, _ := range answers { > >>>> answers[i] = "12345678" // replace this > >>>> } > >>>> > >>>> return answers, nil > >>>> }), > >>>> }, > >>>> } > >>>> > >>>> connection, err := ssh.Dial("tcp", "192.168.0.1:22", c) // replace > this > >>>> if err != nil { > >>>> fmt.Println(err) > >>>> return > >>>> } > >>>> > >>>> server, err := sftp.NewClient(connection) > >>>> if err != nil { > >>>> fmt.Println(err) > >>>> return > >>>> } > >>>> > >>>> dir, err := server.ReadDir(".") > >>>> if err != nil { > >>>> fmt.Println(err) > >>>> return > >>>> } > >>>> > >>>> for _, fi := range dir { > >>>> fmt.Println(fi.Name()) > >>>> } > >>>> } > >>>> > >>>> -- > >>>> You received this message because you are subscribed to the Google > >>>> Groups "golang-nuts" group. > >>>> To unsubscribe from this group and stop receiving emails from it, send > >>>> an email to golang-nuts+unsubscr...@googlegroups.com. > >>>> For more options, visit https://groups.google.com/d/optout. > >>> > >>> > >> > > > > > > -- > Han-Wen Nienhuys > Google Munich > han...@google.com > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] File transfer,but file size is zero
Hi all: I tried to upload file via SFTP,but the file size is zero when it is done.Any suggestions? Thanks so much. //sftp upload package main import ( "fmt" "os" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" ) func main() { c := { User: "root", Auth: []ssh.AuthMethod{ ssh.Password("74634265"), }, } connection, err := ssh.Dial("tcp", "192.168.44.129:22", c) // replace this if err != nil { fmt.Println(err) return } server, err := sftp.NewClient(connection) if err != nil { fmt.Println(err) return } // Open the source file srcFile, err := os.Open("F:/NCA/20161027-1.csv") if err != nil { fmt.Println(err) } defer srcFile.Close() // Create the destination file dstFile, err := server.Create("/root/20161027-1.csv") if err != nil { fmt.Println(err) } defer dstFile.Close() // Copy the file dstFile.WriteTo(srcFile) } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] ssh login failed
Hi Brad: Thanks so much for your suggestion. I run "ssh -v" and get useful information as attachment.So,I modify the code,but occurred the different problem as below. ssh: handshake failed: ssh: unexpected message type 3 (expected one of [6]) // ftp package main import ( "fmt" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" ) func main() { c := { User: "root", Auth: []ssh.AuthMethod{ ssh.Password("12345678"), }, } connection, err := ssh.Dial("tcp", "192.168.44.129:22", c) // replace this if err != nil { fmt.Println(err) return } server, err := sftp.NewClient(connection) if err != nil { fmt.Println(err) return } dir, err := server.ReadDir(".") if err != nil { fmt.Println(err) return } for _, fi := range dir { fmt.Println(fi.Name()) } } 2017-02-07 0:55 GMT+08:00 Brad Fitzpatrick <bradf...@golang.org>: > From looking at: > > ssh: unable to authenticate, attempted methods [none], no supported > methods remain > > It seems like your ssh server requires a different authentication mode and > doesn't support KeyboardInteractive (a password). > > Does the standard ssh client work? What does "ssh -v" say? > > > On Mon, Feb 6, 2017 at 1:25 AM, Robert Hsiung <xiong0...@gmail.com> wrote: > >> Dear all: >> I tried to test sftp function with below coding,but occurred problem as >> below. Please give me suggestions. Thanks so much. >> ssh: handshake failed: ssh: unable to authenticate, attempted methods >> [none], no supported methods remain >> >> >>>> >> package main >> >> import ( >> "fmt" >> "github.com/pkg/sftp" >> "golang.org/x/crypto/ssh" >> ) >> >> func main() { >> >> c := { >> User: "root", // replace this >> Auth: []ssh.AuthMethod{ >> ssh.KeyboardInteractive(func(user, instruction string, questions >> []string, echos []bool) ([]string, error) { >> // Just send the password back for all questions >> answers := make([]string, len(questions)) >> for i, _ := range answers { >> answers[i] = "12345678" // replace this >> } >> >> return answers, nil >> }), >> }, >> } >> >> connection, err := ssh.Dial("tcp", "192.168.0.1:22", c) // replace this >> if err != nil { >> fmt.Println(err) >> return >> } >> >> server, err := sftp.NewClient(connection) >> if err != nil { >> fmt.Println(err) >> return >> } >> >> dir, err := server.ReadDir(".") >> if err != nil { >> fmt.Println(err) >> return >> } >> >> for _, fi := range dir { >> fmt.Println(fi.Name()) >> } >> } >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[go-nuts] ssh login failed
Dear all: I tried to test sftp function with below coding,but occurred problem as below. Please give me suggestions. Thanks so much. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain package main import ( "fmt" "github.com/pkg/sftp" "golang.org/x/crypto/ssh" ) func main() { c := { User: "root", // replace this Auth: []ssh.AuthMethod{ ssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) { // Just send the password back for all questions answers := make([]string, len(questions)) for i, _ := range answers { answers[i] = "12345678" // replace this } return answers, nil }), }, } connection, err := ssh.Dial("tcp", "192.168.0.1:22", c) // replace this if err != nil { fmt.Println(err) return } server, err := sftp.NewClient(connection) if err != nil { fmt.Println(err) return } dir, err := server.ReadDir(".") if err != nil { fmt.Println(err) return } for _, fi := range dir { fmt.Println(fi.Name()) } } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.