Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Config#34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SmsS4 wants to merge6 commits intomelbahja:master
base:master
Choose a base branch
Loading
fromSmsS4:config
Open

Add Config#34

SmsS4 wants to merge6 commits intomelbahja:masterfromSmsS4:config

Conversation

@SmsS4
Copy link

This pr is to solve#31

@DentraxDentrax mentioned this pull requestSep 16, 2023
@Dentrax
Copy link

Dentrax commentedSep 16, 2023
edited
Loading

Thanks for this!@SmsS4

I tried to useNewWithConfigFile() function withgoph.NewConn() but gotopen ~/.ssh/identity: no such file or directory error. Any ideas? 🤔

@SmsS4
Copy link
Author

hmmmm this PRis for 1.5 years ago
I will check it tomorrow :)

Dentrax reacted with thumbs up emoji

@SmsS4SmsS4 closed thisSep 16, 2023
@SmsS4SmsS4 reopened thisSep 16, 2023
@Dentrax
Copy link

Thanks for prompt reply! Also it'd be nice to add another function to return onlyAuth:

funcGetAuth(hoststring) (goph.Auth,error) {auth,err:=goph.Key(ssh_config.Get(host,"IdentityFile"),"")iferr!=nil {returnnil,fmt.Errorf("get key: %w",err)}returnauth,nil}

Copy link
Owner

@melbahjamelbahja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hey thanks for the PR, can you please use return instead of log fatal.

@SmsS4
Copy link
Author

I fixed your comments

@SmsS4
Copy link
Author

Thanks for prompt reply! Also it'd be nice to add another function to return onlyAuth:

funcGetAuth(hoststring) (goph.Auth,error) {auth,err:=goph.Key(ssh_config.Get(host,"IdentityFile"),"")iferr!=nil {returnnil,fmt.Errorf("get key: %w",err)}returnauth,nil}

I used your code in new commit
thanks

By defaultssh_config.Get(host, "IdentityFile") returns~/.ssh/identity so you have to setIdentityFile in ssh config.
for example:

Host vpnHostName 127.0.0.1User testIdentityFile /home/demol/.ssh/id_rsa

@melbahja
Copy link
Owner

Hey thanks for the update,

one more thing if you can useNewConn instead ofNew in case of custom port with fallback to 22.

v2 of this package I should add more configuration options suport

@Dentrax
Copy link

By default ssh_config.Get(host, "IdentityFile") returns ~/.ssh/identity so you have to set IdentityFile in ssh config.

I was wondering if it does make sense toreturn an error in case ifIdentityFile is empty or equals tossh_config.Default("IdentityFile")

Also you'd consider to remove leading and trailing"s, I just filed an issue for that:kevinburke/ssh_config#61

strings.Trim(ssh_config.Get(host,key),"\"")

@SmsS4
Copy link
Author

I will update my fork and useNewConn instead ofNew (probably tomorrow or day after tomorrow
Thanks@melbahja

Hey thanks for the update,

one more thing if you can useNewConn instead ofNew in case of custom port with fallback to 22.

v2 of this package I should add more configuration options suport

@SmsS4
Copy link
Author

By default ssh_config.Get(host, "IdentityFile") returns ~/.ssh/identity so you have to set IdentityFile in ssh config.

I was wondering if it does make sense toreturn an error in case ifIdentityFile is empty or equals tossh_config.Default("IdentityFile")

Also you'd consider to remove leading and trailing"s, I just filed an issue for that:kevinburke/ssh_config#61

strings.Trim(ssh_config.Get(host,key),"\"")

It's probably good idea to use~/.ssh/id_rsa by default and not~/.ssh/identity but I only return error if~/.ssh/identity doesn't exists.
I will update this soon@Dentrax

Dentrax reacted with thumbs up emoji

@SmsS4
Copy link
Author

@melbahja
I used NewConn instead of New with a little bit of refactoring

@melbahja
Copy link
Owner

I'll need a bit of time to test the changes. Thanks.

SmsS4 reacted with thumbs up emoji

@mehrdad-khojastefar

Can you review these changes ? this pr could really help us.

@melbahja
Copy link
Owner

Thessh_config lib has many issues like:

I think you should solve the ssh config problem outside of goph and just pass the hostname, port, and identity to it, and I don't think this is a good think to add it to v1 maybe in v2.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@melbahjamelbahjaAwaiting requested review from melbahja

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@SmsS4@Dentrax@melbahja@mehrdad-khojastefar

[8]ページ先頭

©2009-2025 Movatter.jp